DateTime Today and Now Property in C#
In this article, I would like to show the Today and Now property in C#
In this article, I would like to show the Today and Now property in C#. Both DateTime property are used to show the data and time.
DateTime Today and Now Property
DateTime Today Property
This displays today's date. The time value is 12:00:00.
DateTime Now Property
This displays the current date and time of the system, expressed as the local time. In other words the Now property returns a DateTime object that has the date and time values for right now.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication71
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Today: {0}", DateTime.Today);
Console.WriteLine("Today: {0}", DateTime.Now);
}
}
}
Output