A function for converting a timestamp string into the TIMESTAMPTZ datatype

to_timestamp() is a system function for converting the string representation of a timestamp into the TIMESTAMP WITH TIME ZONE datatype using the specified format.

to_timestamp() was added in PostgreSQL 7.0.


to_timestamp ( text, text ) → timestamp with time zone

to_timestamp() converts the provided string into a TIMESTAMP WITH TIME ZONE value using the specified format; see the PostgreSQL documentation section Template Patterns for Date/Time Formatting for details.

Note there is no equivalent function for converting a string into a plain TIMESTAMP data type.

Change history


Date and time, String manipulation

See also

to_date(), to_char(), to_number()