Formatting dates are easy in C#. The following snippet gets the current date in British format.
private static string ConvertDate2British()
{
return String.Format("{0:dd-MM-yy}", DateTime.Now);
}
How to convert dates to British format using .NET, Date Conversion using .NET, .NET String.Format Method, Get Current Date using .NET, .NET Today Method
See also:
Formatting Date Input - DateFOrmat (SQL)
If we need to convert string to specific date format then regional settings of machine has the important role, see following
ReplyDeletehttp://urenjoy.blogspot.com/2009/03/string-to-datetime-formatexception-and.html