Create a DateTime object from a specific date - CSharp Language Basics

CSharp examples for Language Basics:Date Time

Description

Create a DateTime object from a specific date

Demo Code

using System;//from   w w  w .  j  a v a2  s . c  o m
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
   static void Main(string[] args)
   {
      // A specific date
      DateTime overlordDday = new DateTime(1944, 6, 6);
      // Output
      Console.WriteLine("D-Day (Overlord operation): " +
      overlordDday.ToLongDateString() + ".");
   }
}

Result


Related Tutorials