to_timestamp()

Scalar. Converts a given value to a timestamp.

Syntax

to_timestamp ( value )
to_timestamp ( value, format )

Parameters

value

A string, float, or long. Strings must be in the format specified by the format argument. Numeric values represent the number of microseconds from the epoch (midnight, January 1, 1970 UTC).

format

A format string. Only valid if the value is a string. Must be one of the format codes for a timestamp. See "Date/Time Format Codes" for more information.

Usage

Converts a given value to a timestamp. The function takes a float, a long, or a string (and associated format string) as its argument, and the function returns a timestamp. Note that the function can also take a timestamp as its argument, but it will return the same timestamp.

Examples

to_timestamp('02/19/2010 10:15', '%m/%d/%Y %H:%M') returns 2010-02-19 10:15:00.000.

to_timestamp('07/19/2010 10:15 -07.00', 'MM/DD/YYYY HH:MI TZH:TZM') returns 2010-07-19 03:15:00.000.