Expressions > Syntax rules > Functions

TIME_TO_STR function

Returns the time of day (in ISO 8601 format) based on the specified format and Epoch time (in seconds).

Syntax:

'external reference' := TIME_TO_STR("format", Epoch time);

The following table explains the available formats.

Format

Explanation

%A

Local time in the form YYYY-MM-DDThh:mm:ss

%d

Day of month in the form DD

%D

Date in the form YYYY-MM-DD

%h

Hour of the day in the form hh

%i

Minutes past the hour in the form mm

%j

Day of year (001 - 366)

%m

Month in the form MM

%P

Period format as follows: PXXXXXThh:mm:ss

%s

Seconds past the minute in the form ss

%T

Time in the form hh:mm:ss

%w

Day of week (1-7)

%W

Week of year (01-53)

%y

Year in the form YYYY

Where:
P = literal p character indicates this is a time period
XXXXX = five-digit number of days (00000 - 99999)
T = literal T character indicates beginning of time component
YYYY = year
MM = month
DD = day of month
hh = hour
mm = minutes
ss = seconds

Example:

(* get the current LOCAL time in ISO-8601 format *)
'/CURRENT_TIME' := time('$time_format:Local');
'/TIME_STAMP' := time_to_str("%A", '/CURRENT_TIME');

The above example shows how to get the current time and convert it to an ISO 8061 format for local time. To get the current UTC time as a string, use $time_format:UTC.