Saturday 2 December 2017

C# Program to Display Date in String


Code:

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;
        }
    }
}


Output:

Date and Time  : 6/23/2013 12:00:00 AM
Month and Date : June 23


More C# Programs:


















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...