A
akiecker
I have a string representing the date in US format (mm/dd/yyyy). I use
Convert.ToDateTime() to convert this to a DateTime structure. I then compare
this to the current date DateTime.ToDay.
All works fine until the localization is changed, for example to Germany,
then the string representing the date is incorrectly interpreted as if it
were in the local format dd/mm/yyyy (or is it dd-mm-yyyy) with a resulting
incorrect value for the DateTime with a resultant invalid comparison to the
current date.
Any suggestions on how to handle this would be appreciated.
Is there some way that I can specify that my string should be converted to a
DateTime structure using the “en_US†culture?
Thankyou.
Convert.ToDateTime() to convert this to a DateTime structure. I then compare
this to the current date DateTime.ToDay.
All works fine until the localization is changed, for example to Germany,
then the string representing the date is incorrectly interpreted as if it
were in the local format dd/mm/yyyy (or is it dd-mm-yyyy) with a resulting
incorrect value for the DateTime with a resultant invalid comparison to the
current date.
Any suggestions on how to handle this would be appreciated.
Is there some way that I can specify that my string should be converted to a
DateTime structure using the “en_US†culture?
Thankyou.