Provide functions that can be used to manipulate temporal values provided by MySQL.
Attributes
- See also
- Companion
- object
- Source
- DateTime.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Concrete methods
Function to perform addition on a specified date type column.
Function to perform addition on a specified date type column.
TableQuery[DateTime].select(p => ADDTIME(p.time, LocalTime.of(1, 1, 1, 1)))
// SELECT ADDTIME(time, '01:01:01.000000001') FROM date_time
Value parameters
- column
-
The column to which the addition is to be performed.
- time
-
The time to be added to the column.
Attributes
- Source
- DateTime.scala
Function to perform addition on a specified date type column.
Function to perform addition on a specified date type column.
TableQuery[DateTime].select(p => ADDTIME(LocalTime.of(1, 1, 1, 1), LocalTime.of(1, 1, 1, 1)))
// SELECT ADDTIME('01:01:01.000000001', '01:01:01.000000001') FROM date_time
Value parameters
- dateTime
-
The date time to which the addition is to be performed.
- time
-
The time to be added to the date time.
Attributes
- Source
- DateTime.scala
Function to convert a date-time value dt from the time zone specified by from_tz to the time zone specified by to_tz.
Function to convert a date-time value dt from the time zone specified by from_tz to the time zone specified by to_tz.
TableQuery[DateTime].select(p => CONVERT_TZ(p.timestampe, LocalTime.of(0, 0), LocalTime.of(9, 0)))
// SELECT CONVERT_TZ(timestampe, '+00:00', '+09:00') FROM date_time
Value parameters
- column
-
The column to which the addition is to be performed.
- from
-
The time zone from which the conversion is to be performed.
- to
-
The time zone to which the conversion is to be performed.
Attributes
- Source
- DateTime.scala
Function to convert a date-time value dt from the time zone specified by from_tz to the time zone specified by to_tz.
Function to convert a date-time value dt from the time zone specified by from_tz to the time zone specified by to_tz.
TableQuery[DateTime].select(p => CONVERT_TZ(LocalDateTime.of(2025, 1, 1), LocalTime.of(0, 0), LocalTime.of(9, 0)))
// SELECT CONVERT_TZ('2025-01-01', '+00:00', '+09:00') FROM date_time
Value parameters
- dateTime
-
The date time to which the addition is to be performed.
- from
-
The time zone from which the conversion is to be performed.
- to
-
The time zone to which the conversion is to be performed.
Attributes
- Source
- DateTime.scala
Function to return the current date as 'YYYY-MM-DD' format.
Function to return the current date as 'YYYY-MM-DD' format.
TableQuery[DateTime].select(_ => CURDATE)
// SELECT CURDATE() FROM date_time
Attributes
- Source
- DateTime.scala
Function to return the current time in 'hh:mm:ss' format.
Function to return the current time in 'hh:mm:ss' format.
TableQuery[DateTime].select(_ => CURTIME)
// SELECT CURTIME() FROM date_time
Attributes
- Source
- DateTime.scala
Function to extract the date portion of a date or date-time expression.
Function to extract the date portion of a date or date-time expression.
TableQuery[DateTime].select(p => DATE(p.timestamp))
// SELECT DATE(timestamp) FROM date_time
Value parameters
- column
-
Date or date/time column from which to extract the date portion
Attributes
- Source
- DateTime.scala
Function to extract the date portion of a date or date-time expression.
Function to extract the date portion of a date or date-time expression.
TableQuery[DateTime].select(_ => DATE(LocalDateTime.of(2025, 1, 1, 1, 1)))
// SELECT DATE('2025-01-01T01:01') FROM date_time
Value parameters
- date
-
The date or date-time expression from which the date portion is to be extracted.
Attributes
- Source
- DateTime.scala
Function to calculate the value of the number of days from one date to another.
Function to calculate the value of the number of days from one date to another.
TableQuery[DateTime].select(p => DATEDIFF(p.birthDate, p.deathDate))
// SELECT DATEDIFF(birth_date, death_date) FROM date_time
Value parameters
- from
-
The starting date.
- to
-
The ending date.
Attributes
- Source
- DateTime.scala
Function to calculate the value of the number of days from one date to another.
Function to calculate the value of the number of days from one date to another.
TableQuery[DateTime].select(p => DATEDIFF(p.birthDate, LocalDate.of(2021, 1, 1)))
// SELECT DATEDIFF(birth_date, '2021-01-01') FROM date_time
Value parameters
- from
-
The starting date.
- to
-
The ending date.
Attributes
- Source
- DateTime.scala
Function to calculate the value of the number of days from one date to another.
Function to calculate the value of the number of days from one date to another.
TableQuery[DateTime].select(p => DATEDIFF(p.birthDate, LocalDate.of(2021, 1, 1)))
// SELECT DATEDIFF(birth_date, '2021-01-01') FROM date_time
Value parameters
- from
-
The starting date.
- to
-
The ending date.
Attributes
- Source
- DateTime.scala
Function to perform addition on a specified date type column.
Function to perform addition on a specified date type column.
TableQuery[DateTime].select(p => DATE_ADD(p.birthDate, DateTime.Interval.YEAR(1)))
// SELECT DATE_ADD(birth_date, INTERVAL 1 YEAR) FROM date_time
Value parameters
- column
-
The column to which the addition is to be performed.
- interval
-
The interval to be added to the column.
Attributes
- Source
- DateTime.scala
Function to perform addition on a specified date type column.
Function to perform addition on a specified date type column.
TableQuery[DateTime].select(p => DATE_ADD(LocalDate.now, DateTime.Interval.YEAR(1)))
// SELECT DATE_ADD('2008-02-02', INTERVAL 1 YEAR) FROM date_time
Value parameters
- date
-
The date to which the addition is to be performed.
- interval
-
The interval to be added to the date.
Attributes
- Source
- DateTime.scala
Function to format a date value according to the format string.
Function to format a date value according to the format string.
Value parameters
- column
-
The column to be formatted.
- format
-
The format string.
Attributes
- See also
-
https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-format
TableQuery[DateTime].select(p => DATE_FORMAT(p.timestamp, "%Y-%m-%d")) // SELECT DATE_FORMAT(timestamp, '%Y-%m-%d') FROM date_time
- Source
- DateTime.scala
Function to format a date value according to the format string.
Function to format a date value according to the format string.
TableQuery[DateTime].select(_ => DATE_FORMAT(LocalDate.of(2025, 1, 1), "%Y-%m-%d"))
// SELECT DATE_FORMAT('2025-01-01', '%Y-%m-%d') FROM date_time
Value parameters
- date
-
The date or date-time expression to be formatted.
- format
-
The format string.
Attributes
- Source
- DateTime.scala
Function to perform subtraction on a given date type column.
Function to perform subtraction on a given date type column.
TableQuery[DateTime].select(p => DATE_SUB(p.birthDate, DateTime.Interval.YEAR(1)))
// SELECT DATE_SUB(birth_date, INTERVAL 1 YEAR) FROM date_time
Value parameters
- column
-
The column to which the subtraction is to be performed.
- interval
-
The interval to be subtraction to the column.
Attributes
- Source
- DateTime.scala
Function to perform subtraction on a given date.
Function to perform subtraction on a given date.
TableQuery[DateTime].select(p => DATE_SUB(LocalDate.now, DateTime.Interval.YEAR(1)))
// SELECT DATE_SUB('2008-02-02', INTERVAL 1 YEAR) FROM date_time
Value parameters
- date
-
The date to which the subtraction is to be performed.
- interval
-
The interval to be subtraction to the date.
Attributes
- Source
- DateTime.scala
A function that returns the name of the day of the week corresponding to date. The language used for the names is controlled by the value of the lc_time_names system variable (Section 10.16, “Locale Support in MySQL Server”).
A function that returns the name of the day of the week corresponding to date. The language used for the names is controlled by the value of the lc_time_names system variable (Section 10.16, “Locale Support in MySQL Server”).
Value parameters
- column
-
The date or date-time column from which to extract the day of the week.
Attributes
- See also
-
https://dev.mysql.com/doc/refman/8.0/en/locale-support.html
TableQuery[DateTime].select(p => DAYNAME(p.birthDate)) // SELECT DAYNAME(birth_date) FROM date_time
- Source
- DateTime.scala
A function that returns the name of the day of the week corresponding to date. The language used for the names is controlled by the value of the lc_time_names system variable (Section 10.16, “Locale Support in MySQL Server”).
A function that returns the name of the day of the week corresponding to date. The language used for the names is controlled by the value of the lc_time_names system variable (Section 10.16, “Locale Support in MySQL Server”).
Value parameters
- date
-
The date or date-time expression from which to extract the day of the week.
Attributes
- See also
-
https://dev.mysql.com/doc/refman/8.0/en/locale-support.html
TableQuery[DateTime].select(_ => DAYNAME(LocalDate.of(2021, 1, 1))) // SELECT DAYNAME('2021-01-01') FROM date_time
- Source
- DateTime.scala
A function that returns the day of the month for date, in the range 1 to 31, or 0 for dates such as '0000-00-00' or '2008-00-00' that have a zero day part.
A function that returns the day of the month for date, in the range 1 to 31, or 0 for dates such as '0000-00-00' or '2008-00-00' that have a zero day part.
TableQuery[DateTime].select(p => DAYOFMONTH(p.birthDate))
// SELECT DAYOFMONTH(birth_date) FROM date_time
Value parameters
- column
-
The date or date-time column from which to extract the day of the month.
Attributes
- Source
- DateTime.scala
A function that returns the day of the month for date, in the range 1 to 31, or 0 for dates such as '0000-00-00' or '2008-00-00' that have a zero day part.
A function that returns the day of the month for date, in the range 1 to 31, or 0 for dates such as '0000-00-00' or '2008-00-00' that have a zero day part.
TableQuery[DateTime].select(_ => DAYOFMONTH(LocalDate.of(2021, 1, 1)))
// SELECT DAYOFMONTH('2021-01-01') FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the day of the month.
Attributes
- Source
- DateTime.scala
A function that returns the day of the week for date, in the range 1 to 7, where 1 represents Sunday. Day of the week index (1 = Sunday, 2 = Monday, ..., 7 = Saturday) for date.
A function that returns the day of the week for date, in the range 1 to 7, where 1 represents Sunday. Day of the week index (1 = Sunday, 2 = Monday, ..., 7 = Saturday) for date.
TableQuery[DateTime].select(p => DAYOFWEEK(p.birthDate))
// SELECT DAYOFWEEK(birth_date) FROM date_time
Value parameters
- column
-
The date or date-time column from which to extract the day of the week.
Attributes
- Source
- DateTime.scala
A function that returns the day of the week for date, in the range 1 to 7, where 1 represents Sunday. Day of the week index (1 = Sunday, 2 = Monday, ..., 7 = Saturday) for date.
A function that returns the day of the week for date, in the range 1 to 7, where 1 represents Sunday. Day of the week index (1 = Sunday, 2 = Monday, ..., 7 = Saturday) for date.
TableQuery[DateTime].select(_ => DAYOFWEEK(LocalDate.of(2021, 1, 1)))
// SELECT DAYOFWEEK('2021-01-01') FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the day of the week.
Attributes
- Source
- DateTime.scala
A function that returns the day of the year for date, in the range 1 to 366. The range of DAYOFYEAR() is 1 to 366 because MySQL supports leap year.
A function that returns the day of the year for date, in the range 1 to 366. The range of DAYOFYEAR() is 1 to 366 because MySQL supports leap year.
TableQuery[DateTime].select(p => DAYOFYEAR(p.birthDate))
// SELECT DAYOFYEAR(birth_date) FROM date_time
Value parameters
- column
-
The date or date-time column from which to extract the day of the year.
Attributes
- Source
- DateTime.scala
A function that returns the day of the year for date, in the range 1 to 366. The range of DAYOFYEAR() is 1 to 366 because MySQL supports leap year.
A function that returns the day of the year for date, in the range 1 to 366. The range of DAYOFYEAR() is 1 to 366 because MySQL supports leap year.
TableQuery[DateTime].select(_ => DAYOFYEAR(LocalDate.of(2021, 1, 1)))
// SELECT DAYOFYEAR('2021-01-01') FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the day of the year.
Attributes
- Source
- DateTime.scala
A function that returns the time part of the expression expr as a time value.
A function that returns the time part of the expression expr as a time value.
TableQuery[DateTime].select(p => EXTRACT(p.timestamp, DateTime.TimeUnit.HOUR))
// SELECT EXTRACT(HOUR FROM timestamp) FROM date_time
Value parameters
- column
-
The column from which to extract the time part.
- timeUnit
-
The time unit to be extracted.
Attributes
- Source
- DateTime.scala
A function that returns the time part of the expression expr as a time value.
A function that returns the time part of the expression expr as a time value.
TableQuery[DateTime].select(_ => EXTRACT(LocalDateTime.of(2021, 1, 1, 0, 0), DateTime.TimeUnit.HOUR))
// SELECT EXTRACT(HOUR FROM '2021-01-01T00:00') FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the time part.
- timeUnit
-
The time unit to be extracted.
Attributes
- Source
- DateTime.scala
Function to convert a day value to a date.
Function to convert a day value to a date.
Use FROM_DAYS() carefully with older dates. It is not designed to be used with values prior to the advent of the Gregorian calendar (1582).
Value parameters
- column
-
The column from which to extract the date.
Attributes
- See also
-
https://dev.mysql.com/doc/refman/8.0/en/mysql-calendar.html
TableQuery[DateTime].select(p => FROM_DAYS(p.birthDate)) // SELECT FROM_DAYS(birth_date) FROM date_time
- Source
- DateTime.scala
Function to convert a day value to a date.
Function to convert a day value to a date.
Use FROM_DAYS() carefully with older dates. It is not designed to be used with values prior to the advent of the Gregorian calendar (1582).
Value parameters
- days
-
The number of days from which to extract the date.
Attributes
- See also
-
https://dev.mysql.com/doc/refman/8.0/en/mysql-calendar.html
TableQuery[DateTime].select(_ => FROM_DAYS(730669)) // SELECT FROM_DAYS(730669) FROM date_time
- Source
- DateTime.scala
Function to generate a UTC date in YYYYY-MM-DD hh:mm:ss format from a number.
Function to generate a UTC date in YYYYY-MM-DD hh:mm:ss format from a number.
TableQuery[DateTime].select(p => FROM_UNIXTIME(p.birthDate))
// SELECT FROM_UNIXTIME(birth_date) FROM date_time
Value parameters
- column
-
The column from which to extract the date.
Attributes
- Source
- DateTime.scala
Function to generate a UTC date in YYYYY-MM-DD hh:mm:ss format from a number.
Function to generate a UTC date in YYYYY-MM-DD hh:mm:ss format from a number.
TableQuery[DateTime].select(_ => FROM_UNIXTIME(1612137600))
// SELECT FROM_UNIXTIME(1612137600) FROM date_time
Value parameters
- timestamp
-
The number from which to extract the date.
Attributes
- Source
- DateTime.scala
Function that returns a format string that can be used with DATE_FORMAT() and STR_TO_DATE() functions.
Function that returns a format string that can be used with DATE_FORMAT() and STR_TO_DATE() functions.
TableQuery[DateTime].select(_ => GET_FORMAT(DateTime.DateType.DATE, DateTime.FormatType.USA))
// SELECT GET_FORMAT(DATE, 'USA') FROM date_time
Value parameters
- dateType
-
The type of date/time format (DATE, TIME, DATETIME).
- formatType
-
The format style (EUR, USA, JIS, ISO, INTERNAL).
Attributes
- Source
- DateTime.scala
Function for extracting time-only values from date types. The range of returned values is from 0 to 23 for date-time values. However, since the range of TIME values is actually much larger, HOUR can return values greater than 23.
Function for extracting time-only values from date types. The range of returned values is from 0 to 23 for date-time values. However, since the range of TIME values is actually much larger, HOUR can return values greater than 23.
TableQuery[DateTime].select(p => HOUR(p.birthDate))
// SELECT HOUR(birth_date) FROM date_time
Value parameters
- column
-
The column from which to extract the hour.
Attributes
- Source
- DateTime.scala
Function for extracting time-only values from date types. The range of returned values is from 0 to 23 for date-time values. However, since the range of TIME values is actually much larger, HOUR can return values greater than 23.
Function for extracting time-only values from date types. The range of returned values is from 0 to 23 for date-time values. However, since the range of TIME values is actually much larger, HOUR can return values greater than 23.
TableQuery[DateTime].select(_ => HOUR(LocalTime.of(1, 1, 1, 1)))
// SELECT HOUR('01:01:01.000000001') FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the hour.
Attributes
- Source
- DateTime.scala
Function that returns the value corresponding to the last day of the month from a date or date-time value.
Function that returns the value corresponding to the last day of the month from a date or date-time value.
TableQuery[DateTime].select(p => LAST_DAY(p.birthDate))
// SELECT LAST_DAY(birth_date) FROM date_time
Value parameters
- column
-
The column from which to extract the last day of the month.
Attributes
- Source
- DateTime.scala
Function that returns the value corresponding to the last day of the month from a date or date-time value.
Function that returns the value corresponding to the last day of the month from a date or date-time value.
TableQuery[DateTime].select(_ => LAST_DAY(LocalDate.of(2021, 1, 1)))
// SELECT LAST_DAY('2021-01-01') FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the last day of the month.
Attributes
- Source
- DateTime.scala
Function to return a date calculated from a given year and annual total.
Function to return a date calculated from a given year and annual total.
TableQuery[DateTime].select(p => MAKEDATE(p.birthDate, 1))
// SELECT MAKEDATE(birth_date, 1) FROM date_time
Value parameters
- column
-
The column from which to calculate the date.
- day
-
The annual total from which to calculate the date. The annual total must be greater than 0.
Attributes
- Source
- DateTime.scala
Function to return a date calculated from a given year and annual total.
Function to return a date calculated from a given year and annual total.
TableQuery[DateTime].select(p => MAKEDATE(2021, 1))
// SELECT MAKEDATE(2021, 1) FROM date_time
Value parameters
- day
-
The annual total from which to calculate the date. The annual total must be greater than 0.
- year
-
The year from which to calculate the date.
Attributes
- Source
- DateTime.scala
Function to return a time value calculated from the given hour, minute, and second. The range of the hour is 0 to 23, the range of the minute is 0 to 59, and the range of the second is 0 to 59.
Function to return a time value calculated from the given hour, minute, and second. The range of the hour is 0 to 23, the range of the minute is 0 to 59, and the range of the second is 0 to 59.
TableQuery[DateTime].select(p => MAKETIME(p.hour, p.minute, p.second))
// SELECT MAKETIME(hour, minute, second) FROM date_time
Value parameters
- hour
-
The hour from which to calculate the time.
- minute
-
The minute from which to calculate the time.
- second
-
The second from which to calculate the time.
Attributes
- Source
- DateTime.scala
Function to return a time value calculated from the given hour, minute, and second. The range of the hour is 0 to 23, the range of the minute is 0 to 59, and the range of the second is 0 to 59.
Function to return a time value calculated from the given hour, minute, and second. The range of the hour is 0 to 23, the range of the minute is 0 to 59, and the range of the second is 0 to 59.
TableQuery[DateTime].select(_ => MAKETIME(1, 1, 1))
// SELECT MAKETIME(1, 1, 1) FROM date_time
Value parameters
- hour
-
The hour from which to calculate the time.
- minute
-
The minute from which to calculate the time.
- second
-
The second from which to calculate the time.
Attributes
- Source
- DateTime.scala
Function that returns microseconds from a time or date-time expression as a number in the range 0 to 999999.
Function that returns microseconds from a time or date-time expression as a number in the range 0 to 999999.
TableQuery[DateTime].select(p => MICROSECOND(p.birthDate))
// SELECT MICROSECOND(birth_date) FROM date_time
Value parameters
- column
-
The column from which to extract the microseconds.
Attributes
- Source
- DateTime.scala
Function that returns microseconds from a time or date-time expression as a number in the range 0 to 999999.
Function that returns microseconds from a time or date-time expression as a number in the range 0 to 999999.
TableQuery[DateTime].select(_ => MICROSECOND(LocalDateTime.of(2021, 1, 1, 0, 0)))
// SELECT MICROSECOND('2021-01-01 00:00') FROM date_time
Value parameters
- datetime
-
The date or date-time expression from which to extract the microseconds.
Attributes
- Source
- DateTime.scala
Function that returns the minute part of a date or date-time expression. The range of the minute is 0 to 59.
Function that returns the minute part of a date or date-time expression. The range of the minute is 0 to 59.
TableQuery[DateTime].select(p => MINUTE(p.birthDate))
// SELECT MINUTE(birth_date) FROM date_time
Value parameters
- column
-
The column from which to extract the minute.
Attributes
- Source
- DateTime.scala
Function that returns the minute part of a date or date-time expression. The range of the minute is 0 to 59.
Function that returns the minute part of a date or date-time expression. The range of the minute is 0 to 59.
TableQuery[DateTime].select(_ => MINUTE(LocalDateTime.of(2021, 1, 1, 0, 0)))
// SELECT MINUTE('2021-01-01 00:00') FROM date_time
Value parameters
- time
-
The date or date-time expression from which to extract the minute.
Attributes
- Source
- DateTime.scala
Function that returns the month part of a date or date-time expression. The range of the month is 1 to 12.
Function that returns the month part of a date or date-time expression. The range of the month is 1 to 12.
TableQuery[DateTime].select(p => MONTH(p.birthDate))
// SELECT MONTH(birth_date) FROM date_time
Value parameters
- column
-
The column from which to extract the month.
Attributes
- Source
- DateTime.scala
Function that returns the month part of a date or date-time expression. The range of the month is 1 to 12.
Function that returns the month part of a date or date-time expression. The range of the month is 1 to 12.
TableQuery[DateTime].select(_ => MONTH(LocalDateTime.of(2021, 1, 1, 0, 0)))
// SELECT MONTH('2021-01-01 00:00') FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the month.
Attributes
- Source
- DateTime.scala
Function to return the full name of the month corresponding to a value of type Date. The language used for names is controlled by the value of the lc_time_names system variable (Section 10.16, “Locale Support in MySQL Server”).
Function to return the full name of the month corresponding to a value of type Date. The language used for names is controlled by the value of the lc_time_names system variable (Section 10.16, “Locale Support in MySQL Server”).
Value parameters
- column
-
The date or date-time column from which to extract the month name.
Attributes
- See also
-
https://dev.mysql.com/doc/refman/8.0/en/locale-support.html
TableQuery[DateTime].select(p => MONTHNAME(p.birthDate)) // SELECT MONTHNAME(birth_date) FROM date_time
- Source
- DateTime.scala
Function to return the full name of the month corresponding to a value of type Date. The language used for names is controlled by the value of the lc_time_names system variable (Section 10.16, “Locale Support in MySQL Server”).
Function to return the full name of the month corresponding to a value of type Date. The language used for names is controlled by the value of the lc_time_names system variable (Section 10.16, “Locale Support in MySQL Server”).
Value parameters
- date
-
The date or date-time expression from which to extract the month name.
Attributes
- See also
-
https://dev.mysql.com/doc/refman/8.0/en/locale-support.html
TableQuery[DateTime].select(_ => MONTHNAME(LocalDate.of(2021, 1, 1))) // SELECT MONTHNAME('2021-01-01') FROM date_time
- Source
- DateTime.scala
Function to return the current date and time in 'YYYY-MM-DD hh:mm:ss' format.
Function to return the current date and time in 'YYYY-MM-DD hh:mm:ss' format.
TableQuery[DateTime].select(_ => NOW)
// SELECT NOW() FROM date_time
Attributes
- Source
- DateTime.scala
Function to add the specified month to the yyyyMM value.
Function to add the specified month to the yyyyMM value.
Value parameters
- months
-
The number of months to add.
- period
-
The period in yyyyMM format.
Attributes
- Source
- DateTime.scala
Function to return the number of months between periods.
Function to return the number of months between periods.
TableQuery[DateTime].select(_ => PERIOD_DIFF(YearMonth.of(2008, 2), YearMonth.of(2007, 3)))
// SELECT PERIOD_DIFF(200802, 200703) FROM date_time
Value parameters
- period1
-
First period in YYYYMM format.
- period2
-
Second period in YYYYMM format.
Attributes
- Source
- DateTime.scala
Function to return the quarter corresponding to date in the range 1 to 4.
Function to return the quarter corresponding to date in the range 1 to 4.
TableQuery[DateTime].select(p => QUARTER(p.birthDate))
// SELECT QUARTER(birth_date) FROM date_time
Value parameters
- column
-
The date or date-time column from which to extract the quarter.
Attributes
- Source
- DateTime.scala
Function to return the quarter corresponding to date in the range 1 to 4.
Function to return the quarter corresponding to date in the range 1 to 4.
TableQuery[DateTime].select(_ => QUARTER(LocalDate.of(2021, 1, 1)))
// SELECT QUARTER('2021-01-01') FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the quarter.
Attributes
- Source
- DateTime.scala
Function to return the second part of a date or date-time expression.
Function to return the second part of a date or date-time expression.
TableQuery[DateTime].select(p => SECOND(p.birthDate))
// SELECT SECOND(birth_date) FROM date_time
Value parameters
- column
-
The column from which to extract the second.
Attributes
- Source
- DateTime.scala
Function to return the second part of a date or date-time expression.
Function to return the second part of a date or date-time expression.
TableQuery[DateTime].select(_ => SECOND(LocalDateTime.of(2021, 1, 1, 0, 0)))
// SELECT SECOND('2021-01-01 00:00') FROM date_time
Value parameters
- time
-
The date or date-time expression from which to extract the second.
Attributes
- Source
- DateTime.scala
Function to convert TIME values to hh:mm:ss format.
Function to convert TIME values to hh:mm:ss format.
TableQuery[DateTime].select(p => SEC_TO_TIME(p.seconds))
// SELECT SEC_TO_TIME(seconds) FROM date_time
Value parameters
- column
-
The column to be converted.
Attributes
- Source
- DateTime.scala
Function to convert TIME values to hh:mm:ss format.
Function to convert TIME values to hh:mm:ss format.
TableQuery[DateTime].select(_ => SEC_TO_TIME(3600))
// SELECT SEC_TO_TIME(3600) FROM date_time
Value parameters
- seconds
-
The number of seconds to be converted.
Attributes
- Source
- DateTime.scala
Function to convert a string to a date according to a format string.
Function to convert a string to a date according to a format string.
TableQuery[DateTime].select(p => STR_TO_DATE(p.dateString, "%d,%m,%Y"))
// SELECT STR_TO_DATE(date_string, '%d,%m,%Y') FROM date_time
Value parameters
- column
-
The string column to be converted to a date.
- format
-
The format string specifying how to parse the input string.
Attributes
- Source
- DateTime.scala
Function to convert a string to a date according to a format string.
Function to convert a string to a date according to a format string.
TableQuery[DateTime].select(_ => STR_TO_DATE("01,5,2013", "%d,%m,%Y"))
// SELECT STR_TO_DATE('01,5,2013', '%d,%m,%Y') FROM date_time
Value parameters
- format
-
The format string specifying how to parse the input string.
- str
-
The input string to be converted to a date.
Attributes
- Source
- DateTime.scala
Function to calculate the difference time from a date/time or time type value.
Function to calculate the difference time from a date/time or time type value.
TableQuery[DateTime].select(p => SUBTIME(p.start, p.end))
// SELECT SUBTIME(start, end) FROM date_time
Value parameters
- interval
-
The end time.
- time
-
The start time.
Attributes
- Source
- DateTime.scala
Function to calculate the difference time from a date/time or time type value.
Function to calculate the difference time from a date/time or time type value.
TableQuery[DateTime].select(_ => SUBTIME(LocalDateTime.of(2021, 1, 1, 0, 0), LocalDateTime.of(2021, 1, 1, 0, 0)))
// SELECT SUBTIME('2021-01-01 00:00', '2021-01-01 00:00') FROM date_time
Value parameters
- interval
-
The end time.
- time
-
The start time.
Attributes
- Source
- DateTime.scala
Function to return the current date and time in 'YYYY-MM-DD hh:mm:ss' format.
Function to return the current date and time in 'YYYY-MM-DD hh:mm:ss' format.
TableQuery[DateTime].select(_ => SYSDATE)
// SELECT SYSDATE() FROM date_time
Attributes
- Source
- DateTime.scala
Function to extract only the time portion from a time or date-time expression value.
Function to extract only the time portion from a time or date-time expression value.
TableQuery[DateTime].select(p => TIME(p.birthDate))
// SELECT TIME(birth_date) FROM date_time
Value parameters
- column
-
The column from which to extract the time.
Attributes
- Source
- DateTime.scala
Function to extract only the time portion from a time or date-time expression value.
Function to extract only the time portion from a time or date-time expression value.
TableQuery[DateTime].select(_ => TIME(LocalDateTime.of(2021, 1, 1, 0, 0)))
// SELECT TIME('2021-01-01 00:00') FROM date_time
Value parameters
- time
-
The time or date-time expression from which to extract the time.
Attributes
- Source
- DateTime.scala
A function that calculates the difference of the time portion from a date/time type value and returns the result as a time type.
A function that calculates the difference of the time portion from a date/time type value and returns the result as a time type.
TableQuery[DateTime].select(p => TIMEDIFF(p.start, p.end))
// SELECT TIMEDIFF(start, end) FROM date_time
Value parameters
- end
-
The end time.
- start
-
The start time.
Attributes
- Source
- DateTime.scala
A function that calculates the difference of the time portion from a date/time type value and returns the result as a time type.
A function that calculates the difference of the time portion from a date/time type value and returns the result as a time type.
TableQuery[DateTime].select(p => TIMEDIFF(p.start, LocalDateTime.of(2021, 1, 1, 0, 0)))
// SELECT TIMEDIFF(start, '2021-01-01 00:00') FROM date_time
Value parameters
- end
-
The end time.
- start
-
The start time.
Attributes
- Source
- DateTime.scala
A function that calculates the difference of the time portion from a date/time type value and returns the result as a time type.
A function that calculates the difference of the time portion from a date/time type value and returns the result as a time type.
TableQuery[DateTime].select(_ => TIMEDIFF(LocalDateTime.of(2021, 1, 1, 0, 0), LocalDateTime.of(2021, 1, 1, 0, 0)))
// SELECT TIMEDIFF('2021-01-01 00:00', '2021-01-01 00:00') FROM date_time
Value parameters
- end
-
The end time.
- start
-
The start time.
Attributes
- Source
- DateTime.scala
Function to return a date or date-time format value as a date-time value.
Function to return a date or date-time format value as a date-time value.
TableQuery[DateTime].select(p => TIMESTAMP(p.birthDate))
// SELECT TIMESTAMP(birth_date) FROM date_time
Value parameters
- column
-
The column from which to extract the date-time value.
Attributes
- Source
- DateTime.scala
Function to return a date or date-time format value as a date-time value.
Function to return a date or date-time format value as a date-time value.
TableQuery[DateTime].select(_ => TIMESTAMP(LocalDate.of(2021, 1, 1)))
// SELECT TIMESTAMP('2021-01-01') FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the date-time value.
Attributes
- Source
- DateTime.scala
Function that adds the value of a time expression to the value of a date or date-time expression and returns the result as a date-time value.
Function that adds the value of a time expression to the value of a date or date-time expression and returns the result as a date-time value.
TableQuery[DateTime].select(p => TIMESTAMP(p.birthDate, p.birthTime))
// SELECT TIMESTAMP(birth_date, birth_time) FROM date_time
Value parameters
- column1
-
The date or date-time expression.
- column2
-
The time expression.
Attributes
- Source
- DateTime.scala
Function to add an interval to a date or datetime expression.
Function to add an interval to a date or datetime expression.
TableQuery[DateTime].select(p => TIMESTAMPADD(DateTime.TimeUnit.MINUTE, 1, p.timestamp))
// SELECT TIMESTAMPADD(MINUTE, 1, timestamp) FROM date_time
Value parameters
- column
-
The date or datetime column to which the interval will be added.
- interval
-
The number of units to add.
- unit
-
The time unit specifying how to add the interval.
Attributes
- Source
- DateTime.scala
Function to add an interval to a date or datetime expression.
Function to add an interval to a date or datetime expression.
TableQuery[DateTime].select(_ => TIMESTAMPADD(DateTime.TimeUnit.MINUTE, 1, LocalDateTime.of(2003, 1, 2, 0, 0)))
// SELECT TIMESTAMPADD(MINUTE, 1, '2003-01-02 00:00:00') FROM date_time
Value parameters
- datetime
-
The date or datetime expression to which the interval will be added.
- interval
-
The number of units to add.
- unit
-
The time unit specifying how to add the interval.
Attributes
- Source
- DateTime.scala
Function to calculate the difference between two date or datetime expressions.
Function to calculate the difference between two date or datetime expressions.
TableQuery[DateTime].select(p => TIMESTAMPDIFF(DateTime.TimeUnit.MONTH, p.startDate, p.endDate))
// SELECT TIMESTAMPDIFF(MONTH, start_date, end_date) FROM date_time
Value parameters
- from
-
The starting date or datetime expression.
- to
-
The ending date or datetime expression.
- unit
-
The time unit for the difference calculation.
Attributes
- Source
- DateTime.scala
Function to calculate the difference between two date or datetime expressions.
Function to calculate the difference between two date or datetime expressions.
TableQuery[DateTime].select(p => TIMESTAMPDIFF(DateTime.TimeUnit.MONTH, LocalDate.of(2003, 2, 1), p.endDate))
// SELECT TIMESTAMPDIFF(MONTH, '2003-02-01', end_date) FROM date_time
Value parameters
- from
-
The starting date or datetime expression.
- to
-
The ending date or datetime column.
- unit
-
The time unit for the difference calculation.
Attributes
- Source
- DateTime.scala
Function to calculate the difference between two date or datetime expressions.
Function to calculate the difference between two date or datetime expressions.
TableQuery[DateTime].select(_ => TIMESTAMPDIFF(DateTime.TimeUnit.MONTH, LocalDate.of(2003, 2, 1), LocalDate.of(2003, 5, 1)))
// SELECT TIMESTAMPDIFF(MONTH, '2003-02-01', '2003-05-01') FROM date_time
Value parameters
- from
-
The starting date or datetime expression.
- to
-
The ending date or datetime expression.
- unit
-
The time unit for the difference calculation.
Attributes
- Source
- DateTime.scala
Function to format a time value according to the format string.
Function to format a time value according to the format string.
Value parameters
- column
-
The time column to be formatted.
- format
-
The format string.
Attributes
- See also
-
https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_time-format
TableQuery[DateTime].select(p => TIME_FORMAT(p.time, "%H:%i:%s")) // SELECT TIME_FORMAT(time, '%H:%i:%s') FROM date_time
- Source
- DateTime.scala
Function to format a time value according to the format string.
Function to format a time value according to the format string.
TableQuery[DateTime].select(_ => TIME_FORMAT(LocalTime.of(10, 15, 30), "%H:%i:%s"))
// SELECT TIME_FORMAT('10:15:30', '%H:%i:%s') FROM date_time
Value parameters
- format
-
The format string.
- time
-
The time or date-time expression to be formatted.
Attributes
- Source
- DateTime.scala
Function to convert the time portion from a date type value to seconds.
Function to convert the time portion from a date type value to seconds.
TableQuery[DateTime].select(p => TIME_TO_SEC(p.birthDate))
// SELECT TIME_TO_SEC(birth_date) FROM date_time
Value parameters
- column
-
The column from which to extract the time.
Attributes
- Source
- DateTime.scala
Function to convert the time portion from a date type value to seconds.
Function to convert the time portion from a date type value to seconds.
TableQuery[DateTime].select(_ => TIME_TO_SEC(LocalDateTime.of(2021, 1, 1, 0, 0)))
// SELECT TIME_TO_SEC('2021-01-01 00:00') FROM date_time
Value parameters
- time
-
The time or date-time expression from which to extract the time.
Attributes
- Source
- DateTime.scala
Function to return the number of days since year 0.
Function to return the number of days since year 0.
Use TO_DAYS() carefully with older dates. It is not designed to be used with values prior to the advent of the Gregorian calendar (1582).
Value parameters
- column
-
The date column to convert to days.
Attributes
- See also
-
https://dev.mysql.com/doc/refman/8.0/en/mysql-calendar.html
TableQuery[DateTime].select(p => TO_DAYS(p.birthDate)) // SELECT TO_DAYS(birth_date) FROM date_time
- Source
- DateTime.scala
Function to return the number of days since year 0.
Function to return the number of days since year 0.
Use TO_DAYS() carefully with older dates. It is not designed to be used with values prior to the advent of the Gregorian calendar (1582).
Value parameters
- date
-
The date or date-time expression to convert to days.
Attributes
- See also
-
https://dev.mysql.com/doc/refman/8.0/en/mysql-calendar.html
TableQuery[DateTime].select(_ => TO_DAYS(LocalDate.of(2007, 10, 7))) // SELECT TO_DAYS('2007-10-07') FROM date_time
- Source
- DateTime.scala
Function to return the number of seconds since year 0.
Function to return the number of seconds since year 0.
Use TO_SECONDS() carefully with older dates. It is not designed to be used with values prior to the advent of the Gregorian calendar (1582).
Value parameters
- column
-
The date or datetime column to convert to seconds.
Attributes
- See also
-
https://dev.mysql.com/doc/refman/8.0/en/mysql-calendar.html
TableQuery[DateTime].select(p => TO_SECONDS(p.timestamp)) // SELECT TO_SECONDS(timestamp) FROM date_time
- Source
- DateTime.scala
Function to return the number of seconds since year 0.
Function to return the number of seconds since year 0.
Use TO_SECONDS() carefully with older dates. It is not designed to be used with values prior to the advent of the Gregorian calendar (1582).
Value parameters
- datetime
-
The date or date-time expression to convert to seconds.
Attributes
- See also
-
https://dev.mysql.com/doc/refman/8.0/en/mysql-calendar.html
TableQuery[DateTime].select(_ => TO_SECONDS(LocalDateTime.of(2009, 11, 29, 13, 43, 32))) // SELECT TO_SECONDS('2009-11-29 13:43:32') FROM date_time
- Source
- DateTime.scala
Function to return a Unix timestamp. Without arguments, returns the current Unix timestamp (seconds since '1970-01-01 00:00:00' UTC).
Function to return a Unix timestamp. Without arguments, returns the current Unix timestamp (seconds since '1970-01-01 00:00:00' UTC).
TableQuery[DateTime].select(_ => UNIX_TIMESTAMP())
// SELECT UNIX_TIMESTAMP() FROM date_time
Attributes
- Source
- DateTime.scala
Function to return a Unix timestamp for a given date. Returns seconds since '1970-01-01 00:00:00' UTC for the given date.
Function to return a Unix timestamp for a given date. Returns seconds since '1970-01-01 00:00:00' UTC for the given date.
TableQuery[DateTime].select(p => UNIX_TIMESTAMP(p.timestamp))
// SELECT UNIX_TIMESTAMP(timestamp) FROM date_time
Value parameters
- column
-
The date or datetime column to convert to Unix timestamp.
Attributes
- Source
- DateTime.scala
Function to return a Unix timestamp for a given date. Returns seconds since '1970-01-01 00:00:00' UTC for the given date.
Function to return a Unix timestamp for a given date. Returns seconds since '1970-01-01 00:00:00' UTC for the given date.
TableQuery[DateTime].select(_ => UNIX_TIMESTAMP(LocalDateTime.of(2015, 11, 13, 10, 20, 19)))
// SELECT UNIX_TIMESTAMP('2015-11-13 10:20:19') FROM date_time
Value parameters
- datetime
-
The date or date-time expression to convert to Unix timestamp.
Attributes
- Source
- DateTime.scala
Function to return the current UTC date in 'YYYY-MM-DD' format.
Function to return the current UTC date in 'YYYY-MM-DD' format.
TableQuery[DateTime].select(_ => UTC_DATE())
// SELECT UTC_DATE() FROM date_time
Attributes
- Source
- DateTime.scala
Function to return the current UTC time in 'HH:MM:SS' format.
Function to return the current UTC time in 'HH:MM:SS' format.
TableQuery[DateTime].select(_ => UTC_TIME())
// SELECT UTC_TIME() FROM date_time
Attributes
- Source
- DateTime.scala
Function to return the current UTC time with fractional seconds precision.
Function to return the current UTC time with fractional seconds precision.
TableQuery[DateTime].select(_ => UTC_TIME(6))
// SELECT UTC_TIME(6) FROM date_time
Value parameters
- fsp
-
The fractional seconds precision (0-6).
Attributes
- Source
- DateTime.scala
Function to return the current UTC date and time in 'YYYY-MM-DD HH:MM:SS' format.
Function to return the current UTC date and time in 'YYYY-MM-DD HH:MM:SS' format.
TableQuery[DateTime].select(_ => UTC_TIMESTAMP())
// SELECT UTC_TIMESTAMP() FROM date_time
Attributes
- Source
- DateTime.scala
Function to return the current UTC date and time with fractional seconds precision.
Function to return the current UTC date and time with fractional seconds precision.
TableQuery[DateTime].select(_ => UTC_TIMESTAMP(6))
// SELECT UTC_TIMESTAMP(6) FROM date_time
Value parameters
- fsp
-
The fractional seconds precision (0-6).
Attributes
- Source
- DateTime.scala
Function to return the week number for a date.
Function to return the week number for a date.
TableQuery[DateTime].select(p => WEEK(p.birthDate))
// SELECT WEEK(birth_date) FROM date_time
Value parameters
- column
-
The date or date-time column from which to extract the week number.
Attributes
- Source
- DateTime.scala
Function to return the week number for a date with mode specification.
Function to return the week number for a date with mode specification.
TableQuery[DateTime].select(p => WEEK(p.birthDate, 0))
// SELECT WEEK(birth_date, 0) FROM date_time
Value parameters
- column
-
The date or date-time column from which to extract the week number.
- mode
-
The mode parameter for week calculation (0-7).
Attributes
- Source
- DateTime.scala
Function to return the week number for a date.
Function to return the week number for a date.
TableQuery[DateTime].select(_ => WEEK(LocalDate.of(2008, 2, 20)))
// SELECT WEEK('2008-02-20') FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the week number.
Attributes
- Source
- DateTime.scala
Function to return the week number for a date with mode specification.
Function to return the week number for a date with mode specification.
TableQuery[DateTime].select(_ => WEEK(LocalDate.of(2008, 2, 20), 1))
// SELECT WEEK('2008-02-20', 1) FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the week number.
- mode
-
The mode parameter for week calculation (0-7).
Attributes
- Source
- DateTime.scala
Function to return the weekday index for a date. 0 = Monday, 1 = Tuesday, ... 6 = Sunday
Function to return the weekday index for a date. 0 = Monday, 1 = Tuesday, ... 6 = Sunday
TableQuery[DateTime].select(p => WEEKDAY(p.birthDate))
// SELECT WEEKDAY(birth_date) FROM date_time
Value parameters
- column
-
The date or date-time column from which to extract the weekday index.
Attributes
- Source
- DateTime.scala
Function to return the weekday index for a date. 0 = Monday, 1 = Tuesday, ... 6 = Sunday
Function to return the weekday index for a date. 0 = Monday, 1 = Tuesday, ... 6 = Sunday
TableQuery[DateTime].select(_ => WEEKDAY(LocalDate.of(2008, 2, 3)))
// SELECT WEEKDAY('2008-02-03') FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the weekday index.
Attributes
- Source
- DateTime.scala
Function to return the calendar week of the date as a number in the range from 1 to 53. WEEKOFYEAR() is a compatibility function that is equivalent to WEEK(date,3).
Function to return the calendar week of the date as a number in the range from 1 to 53. WEEKOFYEAR() is a compatibility function that is equivalent to WEEK(date,3).
TableQuery[DateTime].select(p => WEEKOFYEAR(p.birthDate))
// SELECT WEEKOFYEAR(birth_date) FROM date_time
Value parameters
- column
-
The date or date-time column from which to extract the week of year.
Attributes
- Source
- DateTime.scala
Function to return the calendar week of the date as a number in the range from 1 to 53. WEEKOFYEAR() is a compatibility function that is equivalent to WEEK(date,3).
Function to return the calendar week of the date as a number in the range from 1 to 53. WEEKOFYEAR() is a compatibility function that is equivalent to WEEK(date,3).
TableQuery[DateTime].select(_ => WEEKOFYEAR(LocalDate.of(2008, 2, 20)))
// SELECT WEEKOFYEAR('2008-02-20') FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the week of year.
Attributes
- Source
- DateTime.scala
Function to return year and week for a date. The year in the result may be different from the year in the date argument for the first and the last week of the year.
Function to return year and week for a date. The year in the result may be different from the year in the date argument for the first and the last week of the year.
TableQuery[DateTime].select(p => YEARWEEK(p.birthDate))
// SELECT YEARWEEK(birth_date) FROM date_time
Value parameters
- column
-
The date or date-time column from which to extract the year and week.
Attributes
- Source
- DateTime.scala
Function to return year and week for a date with mode specification.
Function to return year and week for a date with mode specification.
TableQuery[DateTime].select(p => YEARWEEK(p.birthDate, 0))
// SELECT YEARWEEK(birth_date, 0) FROM date_time
Value parameters
- column
-
The date or date-time column from which to extract the year and week.
- mode
-
The mode parameter for week calculation (0-7).
Attributes
- Source
- DateTime.scala
Function to return year and week for a date. The year in the result may be different from the year in the date argument for the first and the last week of the year.
Function to return year and week for a date. The year in the result may be different from the year in the date argument for the first and the last week of the year.
TableQuery[DateTime].select(_ => YEARWEEK(LocalDate.of(1987, 1, 1)))
// SELECT YEARWEEK('1987-01-01') FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the year and week.
Attributes
- Source
- DateTime.scala
Function to return year and week for a date with mode specification.
Function to return year and week for a date with mode specification.
TableQuery[DateTime].select(_ => YEARWEEK(LocalDate.of(1987, 1, 1), 0))
// SELECT YEARWEEK('1987-01-01', 0) FROM date_time
Value parameters
- date
-
The date or date-time expression from which to extract the year and week.
- mode
-
The mode parameter for week calculation (0-7).
Attributes
- Source
- DateTime.scala