Please enable JavaScript to view this site.

The TIMESTAMP function returns  a timestamp value from the current date/time in YYYY-MM-DD-HH.MM.SS.mmmmmm format.

Category

Date / Time

Syntax

TIMESTAMP('' [, 'PACKED'] [, precision] )

 

Parameter Descriptions

'' [, 'PACKED'] [, precision]
() or ('') will return the timestamp in the default format YYYY-MM-DD-HH.MM.SS.mmmmmm
'PACKED' (must be enclosed in single quotes) returns the timestamp without punctuation in the format YYYYMMDDHHMMSSmmmmmm
precision  Specifies the number of digits of precision of the fractional second part of the timestamp The default is 6.  The value can be from 1 to 9.

Example

Map the current timestamp into target field CURRENT_TSTAMP. Assume that the current date/time is 12/15/2018 at 10:15am.

CURRENT_TSTAMP = TIMESTAMP ()

Returns the value of 2018-12-15-10.15.00.000000 and maps the result to the target field.

 

Map the current timestamp into target field CURRENT_TSTAMP without punctuation.

CURRENT_TSTAMP = TIMESTAMP ('PACKED')

Returns the value of 20181215101500000000 and maps the result to the target field.

 

Map the current timestamp into target field CURRENT_TSTAMP with 3 microsecond precision.

CURRENT_TSTAMP = TIMESTAMP ('',3)

Returns the value of 2018-12-15-10.15.00.000 and maps the result to the target field.

 

 

Notes:

1.In addition to the default or "PACKED" format options, the DATEFORMAT command may be used to change the global format of the Timestamp.

2.TIMESTAMP() is also often used as input to many other Date and Time functions.