Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / April 2005

Tip: Looking for answers? Try searching our database.

Date Format pb

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Franck - 21 Apr 2005 15:28 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.