How to use Full Date Long Time ("F") Format Specifier
Description
The "F" format is defined by DateTimeFormatInfo.FullDateTimePattern property. For example, the custom format string for the invariant culture is "dddd, dd MMMM yyyy HH:mm:ss".
The following DateTimeFormatInfo properties control the format.
- FullDateTimePattern
- DayNames
- MonthNames
- TimeSeparator
- AMDesignator
- PMDesignator
Example
The following example uses the "F" format specifier to display a date and time value.
//from w ww .ja v a 2 s.com
using System;
using System.Globalization;
class MainClass
{
public static void Main()
{
DateTime date1 = new DateTime(2012, 4, 10, 6, 30, 0);
Console.WriteLine(date1.ToString("F", CultureInfo.CreateSpecificCulture("en-US")));
Console.WriteLine(date1.ToString("F", CultureInfo.CreateSpecificCulture("fr-FR")));
}
}
The code above generates the following result.