Time Statement

Description

Sets the system time.

Syntax

Time = time

The time argument is any numeric or string expression, or any combination, that can represent a time.

Remarks

If time is a string, Time attempts to convert it to a time using the time separators you specified for your system. If it can’t be converted to a valid time, an error occurs.

Note If you use the Time statement to set the time on computers using versions of MS-DOS earlier than version 3.3, the change remains in effect only until you change it again or turn off your computer. Many computers have a battery-powered CMOS RAM that retains date and time information when the computer is turned off. However, to permanently change the time on computers running earlier versions of MS-DOS, you may have to use your Setup disk or perform some equivalent action. Refer to the documentation for your particular system.

See Also

Date Function, Date Statement, Time Function.

Example

This example uses the Time statement to set the computer system time to a user-defined time.


MyTime = #4:35:17 PM#        ' Assign a time.= MyTime                ' Set system time to MyTime.