Skip to main content


Converts time between internal and external formats.




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.


The TimeConvert function returns an external time in the following format:


Leading zeros are displayed.

The TimeConvert function returns an internal date/time in the following format:


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.


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

FeedbackOpens in a new tab