Built-in Functions → Conversion Functions

Conversion functions convert values from one data type to another. Here are the supported functons:

Functions for returning an Integer

Function Syntax Description
int() int(double expr x) Returns an int from a double
quarter() quarter() Returns an int corresponding to the quarter number of the current quarter
quarter() quarter(date_timestamp exp) Returns an int corresponding to the quarter number of the given date or timestamp
quarterDay() quarterDay() Returns an int corresponding to the count of days from the beginning of the quarter till the current date
quarterDay() quarterDay(date_timestamp exp) Returns an int to the count of days from the beginning of the quarter till a given date or timestamp
quarterMonth() quarterMonth() Returns an int corresponding to the month number of the quarter from the beginning of the quarter for the current date
quarterMonth() quarterMonth(date_timestamp exp) Returns an int corresponding to the month number of the quarter from the beginning of the quarter for a given date or timestamp
quarterWeek() quarterWeek() Returns an int corresponding to the week number of the quarter from the beginning of the quarter for the current date
quarterWeek() quarterWeek(date_timestamp exp) Returns an int corresponding to the week number of the quarter from the beginning of the quarter for a given date or timestamp
month() month() Returns an int corresponding to the month value of the current month
monthWeek() monthWeek() Returns an int corresponding to the week number of the current month
monthWeek() monthWeek(date_timestamp exp) Returns an int corresponding to the week number of the month for a given date or timestamp
weekDay() weekDay() Returns an int corresponding to the count of days from the beginning of the week till the current date
weeknum() weeknum() Returns an int corresponding to the week number of the current week for the current year
minute() minute() Returns an int corresponding to the minute value of the current time
hour() hour() Returns an int corresponding to the hour value of the current time
day() day() Returns an int corresponding to the day value of the current date
dayOfYear() dayOfYear(date_timestamp exp) Returns an int corresponding to the day number of the year for a given date or timestamp

Functions for returning a Double

Function Syntax Description
double() double(string expr str) Returns a double from string str
parseDouble() parseDouble(string expr x, string mask) Returns double from a string
monthsBetween() monthsBetween(date_timestamp startDate, date_timestamp endDate) Returns a double corresponding to the number of months between two dates or timestamps

Functions for returning a Long

Function Syntax Description
long() long(double expr x) Returns a long from a double
second() second([timestamp or date] expr t) Returns the seconds component of a timestamp or date expression
long() long(double expr x) Returns a long from a double
epoch() epoch(timestamp expr t) Returns the number of seconds since the epoch given a timestamp value

Functions for returning a String

Function Syntax Description
string() string(int expr n) Returns a string from an int
toChar() toChar(date expr d, string fmt) Returns a string from date d formatted with fmt
monthName() monthName(date_timestamp exp) Returns a string corresponding to the month name of a given date or timestamp.

Functions for returning a Date or Timestamp

Function Syntax Description
parseDate() parseDate(string expr s_date, string mask) Returns date from a string using a specified format
parseTimestamp() parseTimestamp(string expr date, string mask) Return a timestamp from a string with a given time and date format
timestamp() timestamp(string expr t) Returns a timestamp from a string
weekStartDate() weekStartDate(date_timestamp exp) Returns a date corresponding to the first day of the week for a given date or timestamp
weekEndDate() weekEndDate(date_timestamp exp) Returns a date corresponding to the last day of the week for a given date or timestamp