DateTime problems when movign to production environment
I have several forms within my MVC app that have date values which are
chosen via a datepicker tool. This works well when debugging locally but
on deployment to the cloud environment my dates are not being correctly
converted. I have the following code:
string[] uploaddate = form.GetValues("uploaddate");
string[] expirydate = form.GetValues("expirydate");
This gets the date as 31/08/2013 etc. and from here I was converting to
DateTime as follow:
Convert.ToDateTime(uploaddate[0]);
Convert.ToDateTime(expirydate[0]);
When I deploy to the Azure server I receive the following error:
String was not recognized as a valid DateTime.
I think that the instance image has a culture of US while my application
was designed in UK format, how can I go around this problem so that the
information is saved to the database irrespective of the culture of the
user
No comments:
Post a Comment