This program uses the
DateTime struct from the
System namespace to represent a specific date and time.
Now property of the
DateTime struct returns a
DateTime object that represents the current date and time on the local computer. The program prints this object to the console using the
The output of this program will be the current date and time in a specific format, such as “1/8/2023 12:34:56 PM”.
The exact format will depend on the regional settings of the computer.
static void Main()
DateTime currentTime = DateTime.Now;
The Local Time is : 10/22/2022 19:03:03 PM