Dela via


Date and Time for Visual Basic 6.0 Users

Visual Basic 2008 updates the Date, Date$, Time, and Time$ functions, and replaces the Now and Timer functions with properties.

Visual Basic 6.0

In Visual Basic 6.0, the Date and Time functions return the system date and time in the four-byte Date format. Similarly, the Date and Time statements use the Visual Basic 6.0 format to set the system date and time.

The Date$ and Time$ functions return the system date and time in String format.

The Now and Timer functions specify the current date and time and the number of seconds elapsed since midnight.

Visual Basic 2005

Visual Basic 2008 replaces Date and Time with the Today and TimeOfDay properties, which use the eight-byte common language runtime (CLR) DateTime structure. This corresponds with the Date data type in Visual Basic 2008. You can use Today and TimeOfDay to both set and fetch the system date and time.

Visual Basic 2008 replaces the Date$ and Time$ functions with the DateString and TimeString properties. You can use DateString and TimeString to both set and fetch the system date and time.

The Now and Timer functions are replaced by read-only properties of the same names. Their calling sequences remain unchanged.

See Also

Concepts

Format Function for Visual Basic 6.0 Users

Programming Element Support Changes Summary

Reference

Format Function

Today Property

TimeOfDay Property

Date Data Type (Visual Basic)

DateString Property

TimeString Property

Now Property

Timer Property