|
@@ -57,32 +57,32 @@ s|Description
|
|
|
|
|
|
Basic arithmetic operators (`+`, `-`, etc) support date/time parameters as indicated below:
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[dtIntervalPlusInterval]
|
|
|
--------------------------------------------------
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[dtDateTimePlusInterval]
|
|
|
--------------------------------------------------
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[dtMinusInterval]
|
|
|
--------------------------------------------------
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[dtIntervalMinusInterval]
|
|
|
--------------------------------------------------
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[dtDateTimeMinusInterval]
|
|
|
--------------------------------------------------
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[dtIntervalMul]
|
|
|
--------------------------------------------------
|
|
@@ -116,17 +116,17 @@ Unlike CURRENT_DATE, `CURDATE()` can only be used as a function with no argument
|
|
|
|
|
|
This method always returns the same value for its every occurrence within the same query.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[currentDate]
|
|
|
--------------------------------------------------
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[currentDateFunction]
|
|
|
--------------------------------------------------
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[curDateFunction]
|
|
|
--------------------------------------------------
|
|
@@ -134,7 +134,7 @@ include-tagged::{sql-specs}/docs/docs.csv-spec[curDateFunction]
|
|
|
Typically, this function (as well as its twin <<sql-functions-today,TODAY())>> function
|
|
|
is used for relative date filtering:
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[filterToday]
|
|
|
--------------------------------------------------
|
|
@@ -165,29 +165,29 @@ meaning a milliseconds precision current time will be returned.
|
|
|
|
|
|
This method always returns the same value for its every occurrence within the same query.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[currentTime]
|
|
|
--------------------------------------------------
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[currentTimeFunction]
|
|
|
--------------------------------------------------
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[curTimeFunction]
|
|
|
--------------------------------------------------
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[currentTimeFunctionPrecision]
|
|
|
--------------------------------------------------
|
|
|
|
|
|
Typically, this function is used for relative date/time filtering:
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[filterCurrentTime]
|
|
|
--------------------------------------------------
|
|
@@ -221,17 +221,17 @@ meaning a milliseconds precision current date/time will be returned.
|
|
|
|
|
|
This method always returns the same value for its every occurrence within the same query.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[curTs]
|
|
|
--------------------------------------------------
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[curTsFunction]
|
|
|
--------------------------------------------------
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[curTsFunctionPrecision]
|
|
|
--------------------------------------------------
|
|
@@ -239,7 +239,7 @@ include-tagged::{sql-specs}/docs/docs.csv-spec[curTsFunctionPrecision]
|
|
|
Typically, this function (as well as its twin <<sql-functions-now,NOW())>> function is used for
|
|
|
relative date/time filtering:
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[filterNow]
|
|
|
--------------------------------------------------
|
|
@@ -267,7 +267,7 @@ DAY_OF_MONTH(datetime_exp) <1>
|
|
|
|
|
|
Extract the day of the month from a date/datetime.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[dayOfMonth]
|
|
|
--------------------------------------------------
|
|
@@ -291,7 +291,7 @@ DAY_OF_WEEK(datetime_exp) <1>
|
|
|
|
|
|
Extract the day of the week from a date/datetime. Sunday is `1`, Monday is `2`, etc.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[dayOfWeek]
|
|
|
--------------------------------------------------
|
|
@@ -315,7 +315,7 @@ DAY_OF_YEAR(datetime_exp) <1>
|
|
|
|
|
|
Extract the day of the year from a date/datetime.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[dayOfYear]
|
|
|
--------------------------------------------------
|
|
@@ -339,7 +339,7 @@ DAY_NAME(datetime_exp) <1>
|
|
|
|
|
|
Extract the day of the week from a date/datetime in text format (`Monday`, `Tuesday`...).
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[dayName]
|
|
|
--------------------------------------------------
|
|
@@ -363,7 +363,7 @@ HOUR_OF_DAY(datetime_exp) <1>
|
|
|
|
|
|
Extract the hour of the day from a date/datetime.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[hourOfDay]
|
|
|
--------------------------------------------------
|
|
@@ -388,7 +388,7 @@ ISO_DAY_OF_WEEK(datetime_exp) <1>
|
|
|
Extract the day of the week from a date/datetime, following the https://en.wikipedia.org/wiki/ISO_week_date[ISO 8601 standard].
|
|
|
Monday is `1`, Tuesday is `2`, etc.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[isoDayOfWeek]
|
|
|
--------------------------------------------------
|
|
@@ -413,7 +413,7 @@ ISO_WEEK_OF_YEAR(datetime_exp) <1>
|
|
|
Extract the week of the year from a date/datetime, following https://en.wikipedia.org/wiki/ISO_week_date[ISO 8601 standard]. The first week
|
|
|
of a year is the first week with a majority (4 or more) of its days in January.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[isoWeekOfYear]
|
|
|
--------------------------------------------------
|
|
@@ -437,7 +437,7 @@ MINUTE_OF_DAY(datetime_exp) <1>
|
|
|
|
|
|
Extract the minute of the day from a date/datetime.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[minuteOfDay]
|
|
|
--------------------------------------------------
|
|
@@ -461,7 +461,7 @@ MINUTE_OF_HOUR(datetime_exp) <1>
|
|
|
|
|
|
Extract the minute of the hour from a date/datetime.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[minuteOfHour]
|
|
|
--------------------------------------------------
|
|
@@ -485,7 +485,7 @@ MONTH(datetime_exp) <1>
|
|
|
|
|
|
Extract the month of the year from a date/datetime.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[monthOfYear]
|
|
|
--------------------------------------------------
|
|
@@ -509,7 +509,7 @@ MONTH_NAME(datetime_exp) <1>
|
|
|
|
|
|
Extract the month from a date/datetime in text format (`January`, `February`...).
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[monthName]
|
|
|
--------------------------------------------------
|
|
@@ -533,7 +533,7 @@ This function offers the same functionality as <<sql-functions-current-timestamp
|
|
|
the datetime when the current query reached the server. This method always returns the same value for its every
|
|
|
occurrence within the same query.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[nowFunction]
|
|
|
--------------------------------------------------
|
|
@@ -541,7 +541,7 @@ include-tagged::{sql-specs}/docs/docs.csv-spec[nowFunction]
|
|
|
Typically, this function (as well as its twin <<sql-functions-current-timestamp,CURRENT_TIMESTAMP())>> function is used
|
|
|
for relative date/time filtering:
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[filterNow]
|
|
|
--------------------------------------------------
|
|
@@ -565,7 +565,7 @@ SECOND_OF_MINUTE(datetime_exp) <1>
|
|
|
|
|
|
Extract the second of the minute from a date/datetime.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[secondOfMinute]
|
|
|
--------------------------------------------------
|
|
@@ -589,7 +589,7 @@ QUARTER(datetime_exp) <1>
|
|
|
|
|
|
Extract the year quarter the date/datetime falls in.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[quarter]
|
|
|
--------------------------------------------------
|
|
@@ -613,7 +613,7 @@ This function offers the same functionality as <<sql-functions-current-date,CURR
|
|
|
the date when the current query reached the server. This method always returns the same value for its every occurrence
|
|
|
within the same query.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[todayFunction]
|
|
|
--------------------------------------------------
|
|
@@ -621,7 +621,7 @@ include-tagged::{sql-specs}/docs/docs.csv-spec[todayFunction]
|
|
|
Typically, this function (as well as its twin <<sql-functions-current-timestamp,CURRENT_TIMESTAMP())>> function is used
|
|
|
for relative date filtering:
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[filterToday]
|
|
|
--------------------------------------------------
|
|
@@ -645,7 +645,7 @@ WEEK_OF_YEAR(datetime_exp) <1>
|
|
|
|
|
|
Extract the week of the year from a date/datetime.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[weekOfYear]
|
|
|
--------------------------------------------------
|
|
@@ -669,7 +669,7 @@ YEAR(datetime_exp) <1>
|
|
|
|
|
|
Extract the year from a date/datetime.
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[year]
|
|
|
--------------------------------------------------
|
|
@@ -697,14 +697,14 @@ EXTRACT(
|
|
|
Extract fields from a date/datetime by specifying the name of a <<sql-functions-datetime,datetime function>>.
|
|
|
The following
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[extractDayOfYear]
|
|
|
--------------------------------------------------
|
|
|
|
|
|
is the equivalent to
|
|
|
|
|
|
-["source","sql",subs="attributes,callouts,macros"]
|
|
|
+[source, sql]
|
|
|
--------------------------------------------------
|
|
|
include-tagged::{sql-specs}/docs/docs.csv-spec[dayOfYear]
|
|
|
--------------------------------------------------
|