17.07.2013 Views

GWBASIC User's Manual

GWBASIC User's Manual

GWBASIC User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

GW-BASIC <strong>User's</strong> Guide<br />

TIME$ Statement and Variable<br />

Purpose:<br />

To set or retrieve the current time.<br />

Syntax:<br />

As a statement:<br />

TIME$ = string exp<br />

As a variable:<br />

string exp=TIME$<br />

Comments:<br />

string exp is a valid string literal or variable that lets you set hours (hh), hours and minutes<br />

(hh:mm), or hours, minutes, and seconds (hh:mm:ss).<br />

hh sets the hour (0-23). Minutes and seconds default to 00.<br />

hh:mm sets the hour and minutes (0-59). Seconds default to 00.<br />

hh:mm:ss sets the hour, minutes, and seconds (0-59).<br />

If string exp is not a valid string, a "Type mismatch" error results.<br />

As you enter any of the above values, you may omit the leading zero, if any. You must, however,<br />

enter at least one digit. If you wanted to set the time as a half hour after midnight, you could enter<br />

TIME$= "0:30", but not TIME$= ":30".<br />

If any of the values are out of range, an "Illegal function call" error is issued. The<br />

previous time is retained.<br />

The current time is stored if TIME$ is the target of a string assignment.<br />

The current time is fetched and assigned to the string variable if TIME$ is the expression in a LET<br />

or PRINT statement.<br />

If string exp = TIME$, TIME$ returns an 8-character string in the form hh:mm:ss.<br />

Examples:<br />

The following example sets the time at 8:00 A.M.:<br />

TIME$ = "08:00"<br />

PRINT TIME$<br />

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/TIMES.html (1 of 2)28/03/2004 21.29.50

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!