Formats given datetime instance according to RFC 1123 specification and returns formatted date as a string. - CSharp System

CSharp examples for System:DateTime Format

Description

Formats given datetime instance according to RFC 1123 specification and returns formatted date as a string.

Demo Code


using System.Globalization;
using System;//from   w w  w . ja va 2  s .c  om

public class Main{
        /// <summary>
    ///   <para>Formats given date/time instance according to RFC 1123 specification and returns formatted date as a string.</para>
    /// </summary>
    /// <param name="self">Date/time object instance.</param>
    /// <returns>Formatted date/time value as a string.</returns>
    /// <seealso cref="DateTimeFormatInfo"/>
    public static string RFC1121(this DateTime self)
    {
      return self.ToString("r");
    }
}

Related Tutorials