TIME$ system variable

Purpose

Read and/or set the system time.

Syntax

To read the time:

s$ = TIME$

To set the time:

TIME$ = string_expression

Remarks

The system variable TIME$ contains an eight-character string that represents the time of the system clock in the form "hh:mm:ss", where hh is hours (in 24-hour military form), mm is minutes, and ss is seconds.

Assigning string_expression to TIME$ resets the system clock.  string_expression must contain time information in military (24-hour) format.  Minutes and seconds information can be omitted.  For example:

TIME$ = "12"       'set clock to 12 noon

TIME$ = "13:01"    'set clock to 1:01 PM

TIME$ = "13:01:30" 'set clock to 30 sec after 1:01 PM

TIME$ = "0:01"     'set clock to 1 min after midnight

Use the TIMER function to return the number of seconds that have elapsed since midnight (or since the system was booted).

See also

DATE$, MONTHNAME$, POWERTIME, TIMER, TIX