DateTime - ToFullDateTimeString

A DateTime extension method that converts this object to a full date time string.

Try it

public static void Main()
{
    DateTime date = DateTime.Now;

    // C# Extension Method: DateTime - ToFullDateTimeString
	Console.WriteLine("{0, 10} Culture {1, 40}", "Current", date.ToFullDateTimeString());
	
	// C# Extension Method: DateTime - ToFullDateTimeString
	Console.WriteLine("{0, 10} Culture {1, 40}", "fr-FR", date.ToFullDateTimeString("fr-FR"));
	
	var culture = CultureInfo.CreateSpecificCulture("es-ES");
	
	// C# Extension Method: DateTime - ToFullDateTimeString
	Console.WriteLine("{0, 10} Culture {1, 40}", culture, date.ToFullDateTimeString(culture));
}

View Source
using System;
using System.Globalization;

public static partial class Extensions
{
    /// <summary>
    ///     A DateTime extension method that converts this object to a full date time string.
    /// </summary>
    /// <param name="this">The @this to act on.</param>
    /// <returns>The given data converted to a string.</returns>
    public static string ToFullDateTimeString(this DateTime @this)
    {
        return @this.ToString("F", DateTimeFormatInfo.CurrentInfo);
    }

    /// <summary>
    ///     A DateTime extension method that converts this object to a full date time string.
    /// </summary>
    /// <param name="this">The @this to act on.</param>
    /// <param name="culture">The culture.</param>
    /// <returns>The given data converted to a string.</returns>
    public static string ToFullDateTimeString(this DateTime @this, string culture)
    {
        return @this.ToString("F", new CultureInfo(culture));
    }

    /// <summary>
    ///     A DateTime extension method that converts this object to a full date time string.
    /// </summary>
    /// <param name="this">The @this to act on.</param>
    /// <param name="culture">The culture.</param>
    /// <returns>The given data converted to a string.</returns>
    public static string ToFullDateTimeString(this DateTime @this, CultureInfo culture)
    {
        return @this.ToString("F", culture);
    }
}