| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Retrieves the system time as a formatted character string.
Time() --> cHHMMSS
The function returns a character string containing the system time formatted as hh:mm:ss.
Time() is used to obtain a time formatted character string containing hours, minutes and seconds of a 24h clock.
| See also: | AmPm(), Date(), Seconds(), SubStr() |
| Category: | Date and time |
| Source: | rtl\dateshb.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example shows the results of Time() and how to extract
// hour, minutes, and seconds
PROCEDURE Main
LOCAL cTime := Time()
LOCAL cHour, cMin, cSec
? cTime // Result: 13:27:47
cSec := Right ( cTime, 2 )
cMin := SubStr( cTime, 3, 2 )
cHour := Left ( cTime, 2 )
? Val( cHour ) * 3600 + Val( cMin ) * 60 + Val( cSec )
// result: 48467.00
RETURN
http://www.xHarbour.com