Working with Dates

In addition to using strings, you often need to handle dates and moments in time. To accomplish this, the .NET Framework 4.6 provides the System.DateTime value type.

MinValue and MaxValue

Being a value type, System.DateTime has two shared fields: MinValue and MaxValue. These store the minimum accepted date and the maximum date, respectively. The minimum date is 01/01/0001 00:00:00 a.m., and maximum date is 12/31/9999 11:59:59 p.m.

Creating Dates

The Visual Basic grammar offers the Date keyword, which is a lexical representation of the System.DateTime object, so you can use either Date or System.DateTime. For consistency, we use the Date reserved keyword, but keep in mind that this keyword creates (or gets a reference to) ...

Get Visual Basic 2015 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.