Caché Basic Reference
TimeConvert
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Converts time between internal and external formats.
Synopsis
TimeConvert(time,vbToInternal)
TimeConvert(time,vbToExternal)
Arguments
time The time to be converted. An external time is represented as a string, such as “10:23:54”. An internal time is represented as a numeric value, which is the second part of the Caché $H date/time format.
vbToInternal This keyword specifies converting an external time to internal ($H) format.
vbToExternal This keyword specifies converting an internal time ($H format) to external time format.
Description
The TimeConvert function returns an external time in the following format:
00:00:00
Leading zeros are displayed.
The TimeConvert function returns an internal date/time in the following format:
sssss.ff
Where “sssss” is the time count (number of elapsed seconds in the specified day), and “ff” is optional fractional seconds. Fractional seconds are preserved in converting from external to internal format; fractional seconds are truncated when converting from internal to external format. For further details, see $HOROLOG in the Caché ObjectScript Reference.
Examples
The following example takes an external time value, converts the time to an internal format ($HOROLOG) value, then converts this internal value back to an external format time.
Dim GetDT,InTime, ExTime
GetDT = "21:45:23.99"
Println GetDT
InTime = TimeConvert(GetDT,vbToInternal)
Println InTime
ExTime = TimeConvert(InTime,vbToExternal)
Println ExTime
 
See Also