Search code examples
asp.netasp.net-mvcsubsonicculture

Saving DateTime object on UK Dev Server vs US Live Server


I have a site that saves a date in my model to the database.

After launching my site I realised that the server has US regional settings so I had to make sure that all date's on the public site were formatted in the UK format.

However now when I go to my 'Create' page and choose a date and click save I get the error The value '22/11/2009' is not valid for the Date field. which must be coming from the default DataAnnotations on my model.

Is there something I can do to get it to accept UK formatted dates?


Solution

  • I managed to get it working by putting this into the web.config

    <globalization culture="en-GB"/>