Simple Date Problem

  • Thread starter Thread starter Chris Mahoney
  • Start date Start date
C

Chris Mahoney

Hi

I have a one-line web app which works on my test server but not on the
remote server. The line of code is:

Dim myDate As Date = "31/12/2005"

This works here (New Zealand), but when I upload it to the server (USA), I
get the following error:

Cast from string "31/12/2005" to type 'Date' is not valid.

I can see why the problem's occurring - Americans write their dates
backwards. How can I fix this? There must be a setting, similar to SQL
Server's "Language=British", that will make it recognise the dates
correctly. However, I don't know where this setting is :)

Thanks in advance
Chris
 
Hi Chris,

Add this to your web.config and asjust it to your culture :

<configuration>
<system.web>
<globalization
culture="en-US"
uiCulture="de-DE"
/>
</system.web>
</configuration>

Let me know if you have any more questions..

Cheers,
Tom Pester
 
I knew it'd be something simple :)

Thanks!


On 23/6/05 2:50 PM, in article
(e-mail address removed),
 
Back
Top