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

YYYY

Four-digit year

YY

Two-digit year

MM

Two-digit month

MON

Abbreviated or full month name

MMMM

Full month name

DD

Two-digit day of the month (01 - 31)

DY

Abbreviated day of the week

HH24

Two digits for the hour (00 - 23)

HH12

Two digits for the hour (01 - 12)

AM, PM

Use only with HH12 and not with HH24

MI

Two digits for the minutes (00 - 59)

SS

Two digits for the seconds (00 - 59)

FF[0-9]

Fractional seconds from 0 (seconds) to 9 (nanoseconds)

TZH:TZM, TZHTZM, TZH

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.