I have an MVC4 app which is compiled in the UK and hosted on a US server. In my model I have a date field which is required.
Attached to this field is a date picker, on selecting a date it will set a date to be UK format "DD/MM/YYYY" e.g. 23/12/2013. On submitting the form the application throws a validation error as it does not expect the the format.
In MVC4 how do I:
- Accept both date formats i.e. Override the date format? I have set the date format but cannot specify multiple date formats
- Server side I am saving the date to a database using Linq. This also throws an error as an incorrect format. I suspect I will need to convert to a UK date?
- When loading the details put the date in the correct format depending on the user's location
- Detect the location of the user server side?
Has anyone got any details on how to very validation based on globalisation of the user?
Thanks