-
Book Overview & Buying
-
Table Of Contents
Visual Basic Quickstart Guide
By :
In VB, you can modify date and time data using various functions and methods provided by the language. We will focus on creating date and time values, date and time math, and date and time component extraction.
You can create a Date value using the DateValue function or by specifying a date literal in the format #MM/dd/yyyy#, for example:
Dim dateVal As Date = DateValue("10/05/1967") The preceding code creates a Date value representing October 5, 1967. The same thing can be accomplished using the string literal:
Dim dateLit As Date = #10/05/1967#
You can create a Time value using the TimeValue function or by specifying a time literal in the format #hh:mm:ss AM/PM#, for example:
Dim timeVal As Date = TimeValue("11:30:15 AM") This example code creates a Time value representing 11:30:15 AM. The same thing can be accomplished using the time literal:
Dim timeLit As Date = #11:30:15 AM...