C# DateTime ToLongDateString

Description

DateTime ToLongDateString converts the value of the current DateTime object to its equivalent long date string representation.

Syntax

DateTime.ToLongDateString has the following syntax.


public string ToLongDateString()

Returns

DateTime.ToLongDateString method returns A string that contains the long date string representation of the current DateTime object.

Example

The following example demonstrates the ToLongDateString method.


using System;//from   w  w w .  j  a  va  2 s . com

class Sample 
{
    public static void Main() 
    {
        DateTime myDateTime = new System.DateTime(2001, 5, 16, 3, 2, 15);
    
        Console.WriteLine("Long date string:  \"{0}\"\n", myDateTime.ToLongDateString());
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version