TIME Function
Syntax
Arguments
- time_formatCharacter
Optional. Default = "0h:0m:0s". A time format created according to the rules of Date and Time Format Elements.
- timeTime
Default = NOW(). A time value to format.
Returns
- Formatted_Date_TimeCharacter
Returns the current time as a formatted character string.
Description
Returns the current time on the system clock as a string value using the format 'HH:MM:SS', optional format controls other times, passed in time type can be used in place of the current time.
Discussion
TIME() returns a date time value containing a formatted Date Time value. If time_format is not specified, the time is returned in the format HH:MM:SS. The system time is obtained from the system clock (which can be set from DOS).
For information on performing time arithmetic, see the TOSECONDS() and TOTIME() functions.
The optional time_format parameter allows you to create custom date and time formats.
Example
? time("0h:0m:0s:2") = "02:02:30:22" ? time("h:0m:0s:2") = "2:02:30:22" ? time("0h:0m:s:2 AM") = "02:02:30:22 AM" ? time("Weekday Month x, yyyy") = "Friday January 29th, 1999" ? time("dd-Mon-yy") = "29-Jan-99"
Converting a Time value to a Character value:
? time("",now()) = "01/11/2018 11:53:46 21 am" ? t1 = 01/11/2018 11:55:11 02 am ? time("0h-0m-0s.2", t1) = "11-55-11.02"
See Also