Last post Jan 31, 2007 01:52 PM by rmassart
Jan 31, 2007 10:46 AM|rmassart|LINK
I am having trouble validating dates and I believe this is related to the system locale of the server. I am using a call like this in asp.net:
bDateOk = DateTime.TryParse(sDate, dtNew)
I am expecting the format to be dd/mm/yyyy
This works fine on my own machine. So it validates a date such as "19/07/2006".
However when I move the site to our server (which is in the US and was therefore installed with the US locale settings) the above date fails to validate, because it thinks the "19" is a month (ie it is expecting the format to be mm/dd/yyyy).
I would like to be able to set this on the server and have tried setting server locale to be english with the date format "dd/mm/yyyy" and also checked the box on the Advanced tab in the "Regions and Languages" popup to "Apply settings to default account".
But this does not seem to affect asp.net / iis6.
How can I either configure the server to completely UK based, ie dd/mm/yyyy or at least get asp.net 2.0 to use the UK date format.
Thanks for your help.
Jan 31, 2007 11:50 AM|Hope4sun|LINK
Jan 31, 2007 01:52 PM|rmassart|LINK
Using <globalization culture="en-GB" /> seems to have done the trick.