Exception thrown: 'System.FormatException' in mscorlib.dll dates
/* Just putting this here for myself, but maybe it will help someone else too:
If this error occurs when you are importing data from Excel,
it is possible that your computer's regional settings are incorrect.
Try using ExactParse if in C# , and if there are still issues it may be the
Excel/ regional setting combo causing the issue.
*/
try
{
formattedDate = DateTime.ParseExact(dateString, "dd/MM/yyyy", null).ToString("yyyy-MM-dd");
}
catch
{
// Might be the wrong expected format, might be regional settings
}
Also in C#:
- how to redirect to extern page in .net core
- c# check if type implements interface
- nunit return parameter
- list.addrange in c#
- ASP select box all states
- c# string to character array
- c sharp list length
- unity get velocity at point
- c# get desktop path
- binding c#
- conditional compilation c#
- ignore fakeiteasy
- c# how to open file explorer
- unity face direction of movement
- unity onclick object
- c# return two variables of different types
- sticky footer bootstrap 3
- convert generic to type c#
- print content of array c#
- c sharp list of strings
- what is the or symbol in C#
- button color uwp c#
- unity html get request
- get out of foreach statement c#