format_time¶
Description¶
Format the timestamp value in UTC according to the specified format.
Return type¶
string
Domain¶
This is a scalar function (calculates a single output value for a single input row.)
Categories¶
Usage¶
format_time( time, format )
Argument |
Type |
Required |
Multiple |
---|---|---|---|
time |
timestamp |
Required |
Only one |
format |
string |
Required |
Only one |
Input and Output Formats¶
You can use the following formats in this OPAL command:
Format |
Description |
---|---|
|
Four-digit year |
|
Two-digit year |
|
Two-digit month |
|
Abbreviated or full month name |
|
Full month name |
|
Two-digit day of the month (01 - 31) |
|
Abbreviated day of the week |
|
Two digits for the hour (00 - 23) |
|
Two digits for the hour (01 - 12) |
|
Use only with |
|
Two digits for the minutes (00 - 59) |
|
Two digits for the seconds (00 - 59) |
|
Fractional seconds from 0 (seconds) to 9 (nanoseconds) |
|
Time zone hour and minute, offset from UTC. |
Examples¶
make_col year:format_time(@."Valid From", "YYYY")
Extracts the year from the Valid From
column.
make_col formatted:format_time(@."Valid From", 'YYYY-MM-DD"T"HH24:MI:SSTZH:TZM')
Format the Valid From
column according to ISO 8601.
make_col formatted:format_time(@."Valid From", 'DY MON DD HH24:MI:SS YYYY')
Format the Valid From
column similar to the ctime
format.
make_col formatted:format_time(@."Valid From", 'MM/DD/YYYY HH12:MI:SS')
Format the Valid From
column using the US date format and a 12-hour clock.