Full Date Long Time ("F") Format Specifier in C#

The Full Date Long Time ("F") format specifier in C# displays a complete date and time representation in a long format. This format specifier uses the current culture's DateTimeFormatInfo.FullDateTimePattern property to determine the exact format string.

The "F" specifier provides the most comprehensive date and time display, showing the full day name, complete date, and precise time including seconds.

Syntax

Following is the syntax for using the "F" format specifier −

DateTime.ToString("F")
DateTime.ToString("F", CultureInfo)

The default custom format string for "F" is −

dddd, dd MMMM yyyy HH:mm:ss

Using "F" Format with Default Culture

Example

using System;

class Demo {
    static void Main() {
        DateTime myDate = new DateTime(2024, 12, 25, 14, 30, 45);
        Console.WriteLine("Full Date Long Time: " + myDate.ToString("F"));
        
        DateTime currentTime = DateTime.Now;
        Console.WriteLine("Current DateTime: " + currentTime.ToString("F"));
    }
}

The output of the above code is −

Full Date Long Time: Wednesday, December 25, 2024 2:30:45 PM
Current DateTime: Monday, December 09, 2024 10:15:23 AM

Using "F" Format with Different Cultures

Example

using System;
using System.Globalization;

class Demo {
    static void Main() {
        DateTime myDate = new DateTime(2024, 8, 13, 9, 15, 30);
        
        Console.WriteLine("US Format: " + myDate.ToString("F", CultureInfo.CreateSpecificCulture("en-US")));
        Console.WriteLine("UK Format: " + myDate.ToString("F", CultureInfo.CreateSpecificCulture("en-GB")));
        Console.WriteLine("French Format: " + myDate.ToString("F", CultureInfo.CreateSpecificCulture("fr-FR")));
        Console.WriteLine("German Format: " + myDate.ToString("F", CultureInfo.CreateSpecificCulture("de-DE")));
    }
}

The output of the above code is −

US Format: Tuesday, August 13, 2024 9:15:30 AM
UK Format: Tuesday, 13 August 2024 09:15:30
French Format: mardi 13 août 2024 09:15:30
German Format: Dienstag, 13. August 2024 09:15:30

Comparison with Other Date Format Specifiers

Format Specifier Description Example Output
"F" Full Date Long Time Monday, August 13, 2024 9:15:30 AM
"f" Full Date Short Time Monday, August 13, 2024 9:15 AM
"G" General Date Long Time 8/13/2024 9:15:30 AM
"D" Long Date Pattern Monday, August 13, 2024

Using "F" Format with UTC and Local Time

Example

using System;

class Demo {
    static void Main() {
        DateTime localTime = DateTime.Now;
        DateTime utcTime = DateTime.UtcNow;
        
        Console.WriteLine("Local Time (F): " + localTime.ToString("F"));
        Console.WriteLine("UTC Time (F): " + utcTime.ToString("F"));
        
        // Converting UTC to local time
        DateTime convertedLocal = utcTime.ToLocalTime();
        Console.WriteLine("Converted Local (F): " + convertedLocal.ToString("F"));
    }
}

The output of the above code is −

Local Time (F): Monday, December 09, 2024 10:15:23 AM
UTC Time (F): Monday, December 09, 2024 4:15:23 PM
Converted Local (F): Monday, December 09, 2024 10:15:23 AM

Conclusion

The "F" format specifier in C# provides the most detailed standard date and time representation, including the full day name, complete date, and time with seconds. It automatically adapts to different cultures and locales, making it ideal for user-friendly date and time displays in international applications.

Updated on: 2026-03-17T07:04:35+05:30

263 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements