Functions and Directives

Function Time() Foundation

Returns the system time as a formatted character string ("HH:MM:SS").

Time( [<cBaseZone>] ) --> cSystemTime
If the optional parameter cBaseZone has been passed, the returned time will be based on the passed zone information. Otherwise, the current system time will be returned. Currenty supported zone name is: "UTC". Other zones can be determined by passing the signed zone bias in minutes, ie. "-120".

The return value of the function Time() is a character string in which the time is indicated in the format Hours:Minutes:Seconds (HH:MM:SS).


The environment function Time() reads the system time as a character string. The format of the return value depends on the system setting for the time format or can be selected using the SET TIME command. The smallest time unit which is represented by Time() is a full second. The separating character in the formatted character string is dependent on the country-specific configuration setting.

// In the example the return value of Time() is split into 
// hours, minutes and seconds and displayed separately 
// on the screen: 

   LOCAL cTime := Time()       // 11:23:46 
   LOCAL nRow := Row(), nCol := Col() 

   SetPos( MaxRow(), 0 ) 
   ?? "It is", ; 
   SubStr( cTime, 1, 2), "o'clock"     , ; 
   SubStr( cTime, 4, 2), "minutes and" , ; 
   SubStr( cTime, 7, 2), "seconds" 

   // result: It is 11 o'clock 23 minutes and 46 seconds 

   SetPos( nRow, nCol ) 

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.