Conversion Functions

s-Server features a number of conversion functions. Many of these involve dates and timestamps. Date and time patterns are summarized here.

Date and Time Conversion Functions

Function Definition
CHAR_TO_DATE Converts a CHAR or VARCHAR to a DATE
CHAR_TO_TIME Converts a CHAR or VARCHAR to a TIME
CHAR_TO_TIMESTAMP Converts a CHAR or VARCHAR to a TIMESTAMP
DATE_TO_CHAR Returns a VARCHAR representation of a time
MILLIS_TO_TIMESTAMP Converts a Unix epoch time (in milliseconds) to a TIMESTAMP. The epoch is an BIGINT value such as is produced by the UNIX_TIMESTAMP function.
TIME_TO_CHAR Returns a VARCHAR representation of a time
TIMESTAMP_TO_CHAR Returns a VARCHAR representation of a time
TO_TIMESTAMP Converts a Unix epoch time (in milliseconds) to a TIMESTAMP. The epoch is an BIGINT value such as is produced by the UNIX_TIMESTAMP function.
UNIX_TIMESTAMP Converts a timestamp to a Unix timestamp (milliseconds since ‘1970-01-01 00:00:00’ UTC) as a BIGINT.

See also Date and Time Patterns in this guide.

Other Conversion Functions

Function Definition
VARBINARY_TO_STRING Convert a VARBINARY to a VARCHAR using the supplied character set.
VARBINARY_TO_VARCHAR Represent a VARBINARY as a hex-encoded VARCHAR.
VARCHAR_TO_VARBINARY Convert a hex encoded CHAR or VARCHAR to VARBINARY.