O'Reilly logo

Visual Basic 2010 Unleashed by Alessandro Del Sole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with Dates

Together with strings, you often need to handle dates and moments in time. To accomplish this, the .NET Framework 4.0 provides the System.DateTime type, which is a value type.

MinValue and MaxValue

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

Creating Dates

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required