Hi,
Got a pb with american date format MM/dd/YYYY.
My WebService Method convert String to Date.
It works good except for one case : 1/5/2005
Even if I set my regional settings to American, my WebService
understand this date as 1th of May and not %th of january.
I even try to change current thread culture in Application.BeginRequest
but did not work too.
Dim cult As System.Globalization.CultureInfo =
System.Globalization.CultureInfo.CreateSpecificCulture("en-GB")
cult.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy"
System.Threading.Thread.CurrentThread.CurrentCulture = cult
System.Threading.Thread.CurrentThread.CurrentUICulture = cult
Help please !
My only goal is to convert every kind of date to yyyy-mm-dd...
If someone got a universal function to share with me, I'll thank him a
lot.
Katy King - 21 Apr 2005 18:55 GMT
Hi Franck,
Try either DateTime.ParseExact("1/5/2005", "M/d/yyyy");
or DateTime.Parse("1/5/2005", new CultureInfo("en-US"));
Then you can write the dates out again with DateTime.ToString("yyyy-MM-dd");
Katy
From: "Franck" <wesley.saris@gmail.com>
| Hi,
| Got a pb with american date format MM/dd/YYYY.
[quoted text clipped - 17 lines]
| If someone got a universal function to share with me, I'll thank him a
| lot.