Skip to main content

Cast functions and operators

Use the cast function and operator to convert a value to a specific type.

Syntax

cast ( value AS type )
value :: type
ParameterDescription
valueThe value to be converted.
typeThe data type of the returned value.
For the types you can cast the value to, see Casting.

Example

SELECT '2049-01-01 23:34:56+08:00'::timestamp with time zone::varchar;
2049-01-01T15:34:56+00:00

Help us make this doc better!