What is DateTime?

The DateTime struct is used to express an instant in time that includes the date and time of day.

Assigning the current date and time with Now

In the example below, an object is created that contains the date and time of the local computer by using DateTime and Now.

Get hands-on with 1400+ tech skills courses.