FORMAT_TIME
The FORMAT_TIME function converts a Time into a String with two optional parameters, a configurable format, and a locale.
This function interprets its parameters the same as the FORMAT_DATETIME does, see that article for more details.
Declaration
Parameters
time (type: time)
Any time
format_string (optional, type: string, default: ISO 8601 Format, "YYYY-MM-DDThh:mm:ssZ")
The string representing the format to be outputted. The Date units available in the format can be found in Data and Time Formatting Options.
locale (optional, type: string, default: The user's current locale)
The locale the time should be formatted in. This will configure which language formats containing month, and weekday names. Locale must match a valid LCID String.
Return Values
formatted_time_string (type: string)
The formatted Time.
Examples
For the following examples assume we have a variable named example_time that holds a Time that would format to the string "9:41 am".
As with FORMAT_DATETIME, when called with no format string, FORMAT_TIME will generate an ISO 8601 and RFC3339 compatible timestamp. The date portion of the timestamp will default to January 1st, 1970.
Discussion
The TIME_FROM_FORMAT function is the opposite of FORMAT_DATETIME. Rather than converting a DateTime to a String, it converts a String into a DateTime by parsing with a given format string.
Last updated