DateTime in C# current Date and Time

DateTime in C# current Date and Time

In this DateTime example, we will see how to get current datetime of the system. You may require to get server time or stand alone windows application current system time. We will see both and Vb.Net examples. DateTime is a structure in assembly System.

C# program to get current time of the system
using System;
namespace DateAndTime.Example
class Program
static void Main(string[] args)
DateTime dt = DateTime.Now;
Console.WriteLine("Current time of the system in {0}",dt.ToString());
Vb.Net Get current time of the system example
Namespace DateAndTime.Example
Class Program
Private Shared Sub Main(args As String())
Dim dt As DateTime = DateTime.Now
Console.WriteLine("Current time of the system in {0}", dt.ToString())
End Sub
End Class
End Namespace
Date Time Example Date Time Example C# Output Current time of the system in 12/28/2011 9:25:35 PM

Description: DateTime.Now returns the current date and time of the system. It uses current culture information of the system. This example outputs the Today’s date and time. 



C# DateTime DifferenceC# DateTimeDateTimeTryParse using C# and exampleC# Parse method of DateTimeC# DateTime ToString()Date Time in English United KingdomDateTime ParseExact Time 10:10:13 AM hh mm ss tt nullDateTime.Today Vs DateTime.NowDateTime format Time Cache get tomorrows date


My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.

I'm Satalaj.