Returns the current local date in this format: ‘yyyy-mm-dd’. Uses the local clock time by default. If SET TIME ZONE has been called, then the value of CURDATE() is determined by calculating UTC time/date from the system clock and operating system locale setting, then adding the displacement value specified with SET TIME ZONE.
|
|
Returns the current local time in this format: ‘hh:mm:ss’. Uses the local clock time by default. If SET TIME ZONE has been called, then the value of CURTIME() is determined by calculating UTC time/date from the system clock and operating system locale setting, then adding the displacement value specified with SET TIME ZONE.
|
|
Returns a new DATETIME value based on adding an interval to a date. For example, a datapart day, an interval of 11, and a date_exp of January 26, 2020, returns February 6, 2020.
Datepart specifies the part of the date to which interval is added, and must be one of the following values.
year
quarter month day dayofyear week hour minute second millisecond Interval specifies a positive or negative integer value used to increment datepart. If interval contains a fractional portion, the fraction part is ignored.
|
|
Datepart specifies the part of the date on which to calculate the difference, and must be one of the following values.
Start specifies the beginning date for the difference calculation. Start is an expression that returns a DATETIME value or a Unicode character string in a DATE format.
End specifies the ending date for the difference calculation. End is an expression that returns a DATETIME value or a Unicode character string in a DATE format.
Start is subtracted from end. An error is returned if the return value is outside of the range for integer values. See Data Type Ranges.
|
|
Returns an English character string (a VARCHAR) that represents the datepart of date_exp. For example, a datepart month returns the name of the month such as January, February, and so forth. A datepart weekday returns the day of the week such as Monday, Tuesday, and so forth.
Datepart the part of the date to return, and must be one of the following values.
|
|
Returns an integer that represents the datepart of date_exp. For example, a datepart month returns an integer representing the month (January = 1, December = 12). A datepart weekday returns an integer representing the day of the week (Sunday = 1, Saturday = 7).
Datepart is the part of the date to return, and must be one of the following values.
|
|
DAY(date_exp)
|
Returns the day of the month for the given date_exp. Identical to DATEPART(day, date_exp). See DATEPART (datepart, date_exp).
|
DAYNAME (date_exp)
|
Date_exp can be a DATE, TIMESTAMP literal, or a column containing DATE, TIMESTAMP, or DATETIME data.
|
DAYOFMONTH (date_exp)
|
Returns the day of the month in date_exp as an integer in the range of 1 to 31. Date_exp can be a DATE, TIMESTAMP literal, or a column containing DATE, TIMESTAMP, or DATETIME data.
|
DAYOFYEAR (date_exp)
|
Returns the day of the year based on the year field in date_exp as an integer value in the range of 1-366.
|
Returns the extract_field portion of the extract_source. The extract_source argument is a date, time or interval expression.
The permitted values of extract_field are:
|
|
HOUR (time_exp)
|
Returns the hour as an integer in the rage of 0 to 23. Time_exp can be a DATE, TIMESTAMP literal, or a column containing DATE, TIMESTAMP, or DATETIME data.
|
MINUTE (time_exp)
|
Returns the minute as an integer in the range 0 to 59. Time_exp can be a DATE, TIMESTAMP literal, or a column containing DATE, TIMESTAMP, or DATETIME data.
|
MONTH (date_exp)
|
Returns the month as an integer in the range of 1 to 12. Date_exp can be a DATE, TIMESTAMP literal, or a column containing DATE, TIMESTAMP, or DATETIME data.
|
MONTHNAME (date_exp)
|
Returns an English character string containing the name of the month (for example, January through December) for the month portion of date_exp. Date_exp can be a DATE, TIMESTAMP literal, or a column containing DATE, TIMESTAMP, or DATETIME data.
|
Uses the local clock time by default. If SET TIME ZONE has been called, then the value of NOW() is determined by calculating UTC time/date from the system clock and operating system locale setting, then adding the displacement value specified with SET TIME ZONE.
|
|
QUARTER (date_exp)
|
Returns the quarter in date_exp as an integer value in the range of 1- 4, where 1 represents January 1 through March 31. Date_exp can be a DATE, TIMESTAMP literal, or a column containing DATE, TIMESTAMP, or DATETIME data.
|
SECOND (time_exp)
|
Returns the second as an integer in the range of 0 to 59. Time_exp can be a DATE, TIMESTAMP literal, or a column containing DATE, TIMESTAMP, or DATETIME data.
|
The allowed values for interval are:
|
|
Returns the integer number of intervals of type interval by which timestamp_exp2 is greater than timestamp_exp1.
|
|
WEEK (date_exp)
|
Returns the week of the year based on the week field in date_exp as an integer in the range of 1 to 53. Date_exp can be a DATE, TIMESTAMP literal, or a column containing DATE, TIMESTAMP, or DATETIME data.
|
WEEKDAY(date_exp)
|
Returns the day of the week for the given date_exp, where 1=Sunday and 7=Saturday. Identical to DATEPART(weekday, date_exp). See DATEPART (datepart, date_exp).
|
YEAR (date_exp)
|
Returns the year as an integer value. The range depends on the data source. Date_exp can be a DATE, TIMESTAMP literal, or a column containing DATE, TIMESTAMP, or DATETIME data.
|