Convert Date String from UK Format To US Format
Many of us had to deal with this scenario. .NET provides ready made classes to do this for us. We can extend this to convert to any different format around the world.
The UK format is used in countries like India, Bangladesh, etc.
You have to make use of System.Globalization namespace
DateTime indianDateTimeValue = DateTime.MinValue;
string indianDateString = "23/03/2007";
DateTimeFormatInfo ukFormat = new CultureInfo("en-GB", false).DateTimeFormat;
indianDateTimeValue = Convert.ToDateTime(indianDateString, ukFormat);
Happy programming,
Anton
The UK format is used in countries like India, Bangladesh, etc.
You have to make use of System.Globalization namespace
DateTime indianDateTimeValue = DateTime.MinValue;
string indianDateString = "23/03/2007";
DateTimeFormatInfo ukFormat = new CultureInfo("en-GB", false).DateTimeFormat;
indianDateTimeValue = Convert.ToDateTime(indianDateString, ukFormat);
Happy programming,
Anton
Labels: C# Code Snippet