Futurebasic/Language/Reference/timestring

From Wikibooks, open books for an open world
Jump to navigation Jump to search

TIME$[edit | edit source]

Function[edit | edit source]

(+) Appearance (+) Standard (+) Console

Syntax[edit | edit source]

currentTime$ = TIME$

Description[edit | edit source]

This function returns the current time of day as an 8-character string in this format: hh:mm:ss where hh is a 2-digit hour in 24-hour format ("00" through "23"), mm is a 2-digit minutes value ("00" through "59"), and ss is a 2-digits seconds value ("00" through "59"). Example: This program speaks one of three appropriate phrases depending on the time of day. hour = VAL(LEFT$(TIME$,2)) SELECT CASE hour

 CASE >= 18

oserr = FN SPEAKSTRING("Good evening.")

 CASE >= 12

oserr = FN SPEAKSTRING("Good afternoon.")

 CASE ELSE

oserr = FN SPEAKSTRING("Good morning.") END SELECT WHILE FN SPEECHBUSY WEND Note: To get a time string which is formatted according to the user's "Date & Time" preferences, use the Toolbox procedure IUTIMESTRING. For example: DIM timeStr$, @ t& CALL GETDATETIME( t& ) CALL TIMESTRING( t&, _false, timeStr$ , _nil ) PRINT "The time is now "; timeStr$

See Also[edit | edit source]

DATE$; TIMER function