Click here to Skip to main content
16,016,501 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to set format datetime for iis and when publish project the format date changed why??
Posted
Comments
Which Date and where? Please add more information.
[no name] 10-Apr-14 10:36am    
Probably because the format is different on the server.....

1 solution

If you do not supply a specific format for DateTime variables, the ToString() method will be called with the default setting for the CurrentCulture / CurrentUICulture of your application.
Hence you have two solutions:
- provide the format evertime yourself (myDateTimeVariable.ToString("dd-MM-yyyy"))
- set the Culture for every new thread (Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("de-AT"))
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900