timestampMask

Returns "string_expression1", representing a timestamp with time zone, trimmed to the format specified in "string_expression2". The format in "string_expression2" must be one of the following: 'yyyy', 'mm', 'dd', 'yyyy-mm', 'yyyymm', 'yyyy-mm-dd', 'yyyymmdd', 'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:mm:ss+hh:mm', 'yyyy-mm-dd hh:mm:ss.ff3', 'yyyy-mm-dd hh:mm:ss.ff3+hh:mm', 'yyyy-mm-ddThh:mm:ss', 'yyyy-mm-ddThh:mm:ss+hh:mm', 'yyyy-mm-ddThh:mm:ss.ff3+hh:mm', or 'yyyy-mm-ddThh:mm:ss.ff3+hh:mm'. The macro functions that return a string representation of a timestamp with time zone show a precision of 9 digits for the fractional part of the seconds by default. The format options allow this to be trimmed down to a precision of 3 or 0.

Syntax

timestampMask ( string_expression1 , string_expression2 )

Example 1

# timestampMask ( $current_timestamp , 'yyyy-dd-mm' ) #

Result

2005-11-01

Example 2

# timestampMask (  '2005-11-01 12:00:00.000-05:00' , 'yyyy-mm-dd 
hh:mm:ss+hh:mm' ) #

Result

2005-11-01 12:00:00-05:00

Example 3

# timestampMask (  '2005-11-01 12:00:00.123456789-05:00' ,
 'yyyy-mm-ddThh:mm:ss+hh:mm.ff3+hh:mm' ) #

Result

2005-11-01T12:00:00.123-05:00