TIME$

Format

string1 = TIME$

Description

This statement will retrieve the current time from the PC's system clock. The time will be retrieved and stored in String1, in the format: "HH.MM.SS".

Example

CURTIME$=TIME$
PRINT CURTIME$
After execution of the above statements the current time (as per the PC's internal clock) will be displayed on the screen.

Comments

Note: if the time printed is wrong, you have probably not set the system clock. Most older XTs and PCs do not have a battery to preserve the DATE and TIME in the system clock, so you have to set them each time you power up the PC. Most ATs and newer PCs have a battery backup, so that the date is preserved for you.

Unlike GWBASIC/BASICA, you cannot set the system time with TIME$, however, you can set the system time from DOS by typing TIME.

See Also

  • DATE$
  • TIMER