C# DateTime ToShortDateString
Description
DateTime ToShortDateString
converts the value of the
current DateTime object to its equivalent short date string representation.
Syntax
DateTime.ToShortDateString
has the following syntax.
public string ToShortDateString()
Returns
DateTime.ToShortDateString
method returns A string that contains the short date string representation of the current
DateTime object.
Example
The following example demonstrates the ToShortDateString method.
using System;//from ww w . ja va 2 s. co m
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.ToShortDateString());
}
}
The code above generates the following result.