DateTime Struct

Understand how to initialize, format, and manipulate dates and times using the DateTime struct.

The DateTime struct is a value type that represents any date and time between midnight on January 1, 0001, and 11:59:59 PM on December 31, 9999.

Note: The DateTime struct follows the Gregorian calendar. We must account for this behavior if our application processes dates prior to October 15, 1582.

Creating a DateTime variable

Like other .NET types, we can initialize a DateTime value using one of its constructors: