date problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I'm using asp.net , visual studio.NET 2003 , c#.
I have a problem that occurred only on my computer And not on other
developer's computers.
My CultureInfo.CurrentCulture is "he-IL"
But when I'm using :
DateTime.Now.ToShortDateString() (my short date format is dd/mm/yyyy)
The function return every time a different date like "06/25/2004)
even that the current date is "06/12/2004"

Also, when I'm using DateTime.Parse("05/05/05")
I'm getting the following error :
System.SystemException {"Could not determine the order of year, month, and
date from dd/mm/yyyy."}
Thanks,
Danny
 
I personally always use "dd MMM yyyy" when passing dates around as a string,
so that the field ordering cannot be confused, then if the client wishes to
have the date format in dd/mm/yy, I simply render it as such.

05/05/05 is confusing. It would depend on what country your in (i.e. localle
settings)

We've had an issue with Sql Server where an app I write with all the localle
settings on the machine and applications set to UK, and we passed the date
as dd/mm/yyyy. Every month it would fall over as soon as it got to say the
5th of the 5th, because Sql Server would apparently revert back to the US
dates (mm/dd/yyyy) and so would get to the 6th of the 5th and suddenly we're
jumping a month ahead!
 
Back
Top