Page tree
Skip to end of metadata
Go to start of metadata

CAST() 

cast(expression AS data_type) - converts a given value from one data type to another.

Example:

cast(sale_date as string)

cast('1999-07-20 00:00:00' as timestamp)

cast('1999-07-20 00:00:00' as string)


TO_TIMESTAMP()

to_timestamp(s) – Explicitly converts string s to timestamp.

Example:

to_timestamp('1999-07-20 00:00:00')


UNIX_TIMESTAMP()

unix_timestamp(ts) - Convert timestamp ts to integer values representing the number of seconds since the epoch: 1970/1/1.

Example:

unix_timestamp('1999-07-20 00:00:00') -> 932428800

See Also

Data Types