Create DateTime type variable - CSharp Language Basics

CSharp examples for Language Basics:Date Time

Description

Create DateTime type variable

Demo Code

using System;//from  w  ww.j  a  va  2 s. c om
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
   static void Main(string[] args)
   {
      // Variable of DateTime type, at first empty
      DateTime now;
      // Storing of current date and time into our variable
      now = DateTime.Now;
      // Output
      Console.WriteLine("Now is " + now);
   }
}

Result


Related Tutorials