Fixed "String was not recognized as a valid DateTime." issue in SharePoint 2013
I met the issue "String was not recognized as a valid DateTime." in a WebPart in SharePoint 2013 site. The issue was occur in a line of code: DateTime.Parse(dr["DUE_DATE"].ToString());
The code works fine in production environment and I verified the date format for "dr["DUE_DATE"].ToString()" was "10/03/2016" (Australian Date format).
I went to "Site settings"-> "Regional settings" and then changed the "Locale" drop down list to "English (Australia)" as below screenshot. Now the issue is gone and the Date time value is showing in the WebPart!
Comments
Post a Comment