Format a DateTime with CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern
using System;
using System.Globalization;
public class Example
{
public static void Main()
{
DateTime date1 = new DateTime(2010, 6, 30);
Console.WriteLine("D Format Specifier: {0:D}", date1);
string longPattern = CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern;
Console.WriteLine("'{0}' custom format string: {1}",
longPattern, date1.ToString(longPattern));
}
}
/*
D Format Specifier: Wednesday, June 30, 2010
'dddd, MMMM dd, yyyy' custom format string: Wednesday, June 30, 2010
*/
Related examples in the same category