Timestamp | TIMESTAMP

Syntax

TIMESTAMP( [value], [default = 0] )

Parameters

input
Any data may be used as the input.

default optional
If input cannot be converted to a date value, default the timestamp value of default returned. default may be any value, but the default value will be coerced into a date and then a timestamp value.

Return Value

The timestamp of the input value as a date is returned.

Description

Converts any input into the equivalent Unix epoch time integer which is the number of seconds since January 1st 1970.

Examples

TIMESTAMP(DATE(1000)) # returns 1000
TIMESTAMP('Tue Aug 29 2017 11:00:49 GMT-0600 (MDT)') # returns 1504026049
TIMESTAMP(null, DATE(1000)) # returns 1000
TIMESTAMP(null) # returns 0