hi I hope to explain myself very well this time
My SO: Win XP Spanish
My DB: Access 2000 Spanish
My Regional Config: Spanish
I'm the only one saving and retriving data from the DB, I don't have
problems showing data but retrieving data via Select
On my DB Access
----------------------
Date format: Fecha general 19/06/1994 05:34:23 p.m.
On the DB the dates are being saved like this (dd/MM/yyyy)
24/11/2004 08:26:10 a.m.
03/11/2004 01:42:02 p.m.
good!
-----------------------------------
At this time I have to switch between two cultures in order to run my select
on every date of the month
Public Formato As New System.Globalization.CultureInfo("es-VE", True)
Public Formato As New System.Globalization.CultureInfo("en-US", True)
this is an extract from my selects:
Where FechaSorteo = #" &
DateTime.Parse(DTPickerDate.Value.ToShortDateString(), Formato) & "#"
Where FechaSorteo = #" & DateTime.Parse(DateTime.Today.ToShortDateString(),
Formato) & "#"
good!
------------------------------------
When I run my selects on the following dates , this is what happends
24/11/2004 08:26:10 a.m.
with Format in spanish: Good!
with Format in english: The string can not be recognized as a valid DateTime
03/11/2004 01:42:02 p.m.
with Format in spanish: Return nothing
with Format in english: Good!
-------------------------------------
I notice that:
I have to use English Culture from 01/11/2004 to 12/11/2004
and spanish Culture from 13/11/2004 to 30/11/2004
I dont know how to fix it
Ken
Maqsood Ahmed - 17 Nov 2004 16:34 GMT
The reason behind this is that the CultureInfo "en-US" assumes DateTime
string is in format "MM/dd/yyyy" and "es-VE" accepts DateTime string as
"dd/MM/yyyy".
A little test to show it is :
Console.WriteLine(DateTime.Now.ToString("d",new
System.Globalization.CultureInfo("en-US")));
Console.WriteLine(DateTime.Now.ToString("d",new
System.Globalization.CultureInfo("es-VE")));
You better try converting es-VE dateTime string to en-US datetime string
before converting it to datetime...
cheers.
Maqsood Ahmed
Kolachi Advanced Technologies
http://www.kolachi.net