Parsing DateTime values in C#
Just a post to outline a few extra ways of parsing dates in C#. These are useful for internationalised apps. try{ //Tell the parser to expect a en-GB (culture) date DateTime myDate = DateTime.Parse(“20/02/2010”, new CultureInfo(“en-GB”)); //Tell the parser to expect a date with a specific format DateTime myDateExact = DateTime.ParseExact(“20/02/2010”, “dd/MM/yyyy”, null); //Tell the …