programming-examples/c-sharp/Strings/C# Program to Display Date in String.cs
2019-11-15 12:59:38 +01:00

23 lines
484 B
C#

/*
* C# Program to Display Date in String
*/
using System;
namespace DateAndTime
{
class Program
{
static int Main()
{
DateTime date = new DateTime(2013,6, 23);
string strDate = date.ToString("M");
Console.WriteLine("Date and Time : {0}", date);
Console.WriteLine("Month and Date : {0}", strDate);
Console.Read();
return 0;
}
}
}
/*
Date and Time : 6/23/2013 12:00:00 AM
Month and Date : June 23