date-time.asciidoc 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[sql-functions-datetime]]
  4. === Date/Time and Interval Functions and Operators
  5. {es-sql} offers a wide range of facilities for performing date/time manipulations.
  6. [[sql-functions-datetime-interval]]
  7. ==== Intervals
  8. A common requirement when dealing with date/time in general revolves around
  9. the notion of `interval`, a topic that is worth exploring in the context of {es} and {es-sql}.
  10. {es} has comprehensive support for <<date-math, date math>> both inside <<date-math-index-names, index names>> and <<mapping-date-format, queries>>.
  11. Inside {es-sql} the former is supported as is by passing the expression in the table name, while the latter is supported through the standard SQL `INTERVAL`.
  12. The table below shows the mapping between {es} and {es-sql}:
  13. [cols="^m,^m"]
  14. |==========================
  15. s|{es}
  16. s|{es-sql}
  17. 2+h| Index/Table datetime math
  18. 2+|<index-{now/M{YYYY.MM}}>
  19. 2+h| Query date/time math
  20. | 1y | INTERVAL 1 YEAR
  21. | 2M | INTERVAL 2 MONTH
  22. | 3w | INTERVAL 21 DAY
  23. | 4d | INTERVAL 4 DAY
  24. | 5h | INTERVAL 5 HOUR
  25. | 6m | INTERVAL 6 MINUTE
  26. | 7s | INTERVAL 7 SECOND
  27. |==========================
  28. `INTERVAL` allows either `YEAR` and `MONTH` to be mixed together _or_ `DAY`, `HOUR`, `MINUTE` and `SECOND`.
  29. TIP: {es-sql} accepts also the plural for each time unit (e.g. both `YEAR` and `YEARS` are valid).
  30. Example of the possible combinations below:
  31. [cols="^,^"]
  32. |===
  33. s|Interval
  34. s|Description
  35. | `INTERVAL '1-2' YEAR TO MONTH` | 1 year and 2 months
  36. | `INTERVAL '3 4' DAYS TO HOURS` | 3 days and 4 hours
  37. | `INTERVAL '5 6:12' DAYS TO MINUTES` | 5 days, 6 hours and 12 minutes
  38. | `INTERVAL '3 4:56:01' DAY TO SECOND` | 3 days, 4 hours, 56 minutes and 1 second
  39. | `INTERVAL '2 3:45:01.23456789' DAY TO SECOND` | 2 days, 3 hours, 45 minutes, 1 second and 234567890 nanoseconds
  40. | `INTERVAL '123:45' HOUR TO MINUTES` | 123 hours and 45 minutes
  41. | `INTERVAL '65:43:21.0123' HOUR TO SECONDS` | 65 hours, 43 minutes, 21 seconds and 12300000 nanoseconds
  42. | `INTERVAL '45:01.23' MINUTES TO SECONDS` | 45 minutes, 1 second and 230000000 nanoseconds
  43. |===
  44. ==== Comparison
  45. Date/time fields can be compared to <<date-math, date math>> expressions with the equality (`=`) and `IN` operators:
  46. [source, sql]
  47. --------------------------------------------------
  48. include-tagged::{sql-specs}/docs/docs.csv-spec[dtDateMathEquals]
  49. --------------------------------------------------
  50. [source, sql]
  51. --------------------------------------------------
  52. include-tagged::{sql-specs}/docs/docs.csv-spec[dtDateMathIn]
  53. --------------------------------------------------
  54. ==== Operators
  55. Basic arithmetic operators (`+`, `-`, `*`) support date/time parameters as indicated below:
  56. [source, sql]
  57. --------------------------------------------------
  58. include-tagged::{sql-specs}/docs/docs.csv-spec[dtIntervalPlusInterval]
  59. --------------------------------------------------
  60. [source, sql]
  61. --------------------------------------------------
  62. include-tagged::{sql-specs}/docs/docs.csv-spec[dtDateTimePlusInterval]
  63. --------------------------------------------------
  64. [source, sql]
  65. --------------------------------------------------
  66. include-tagged::{sql-specs}/docs/docs.csv-spec[dtMinusInterval]
  67. --------------------------------------------------
  68. [source, sql]
  69. --------------------------------------------------
  70. include-tagged::{sql-specs}/docs/docs.csv-spec[dtIntervalMinusInterval]
  71. --------------------------------------------------
  72. [source, sql]
  73. --------------------------------------------------
  74. include-tagged::{sql-specs}/docs/docs.csv-spec[dtDateTimeMinusInterval]
  75. --------------------------------------------------
  76. [source, sql]
  77. --------------------------------------------------
  78. include-tagged::{sql-specs}/docs/docs.csv-spec[dtIntervalMul]
  79. --------------------------------------------------
  80. ==== Functions
  81. Functions that target date/time.
  82. [[sql-functions-current-date]]
  83. ==== `CURRENT_DATE/CURDATE`
  84. .Synopsis:
  85. [source, sql]
  86. --------------------------------------------------
  87. CURRENT_DATE
  88. CURRENT_DATE()
  89. CURDATE()
  90. --------------------------------------------------
  91. *Input*: _none_
  92. *Output*: date
  93. *Description*: Returns the date (no time part) when the current query reached the server.
  94. It can be used both as a keyword: `CURRENT_DATE` or as a function with no arguments: `CURRENT_DATE()`.
  95. [NOTE]
  96. Unlike CURRENT_DATE, `CURDATE()` can only be used as a function with no arguments and not as a keyword.
  97. This method always returns the same value for its every occurrence within the same query.
  98. [source, sql]
  99. --------------------------------------------------
  100. include-tagged::{sql-specs}/docs/docs.csv-spec[currentDate]
  101. --------------------------------------------------
  102. [source, sql]
  103. --------------------------------------------------
  104. include-tagged::{sql-specs}/docs/docs.csv-spec[currentDateFunction]
  105. --------------------------------------------------
  106. [source, sql]
  107. --------------------------------------------------
  108. include-tagged::{sql-specs}/docs/docs.csv-spec[curDateFunction]
  109. --------------------------------------------------
  110. Typically, this function (as well as its twin <<sql-functions-today,TODAY())>> function
  111. is used for relative date filtering:
  112. [source, sql]
  113. --------------------------------------------------
  114. include-tagged::{sql-specs}/docs/docs.csv-spec[filterToday]
  115. --------------------------------------------------
  116. [[sql-functions-current-time]]
  117. ==== `CURRENT_TIME/CURTIME`
  118. .Synopsis:
  119. [source, sql]
  120. --------------------------------------------------
  121. CURRENT_TIME
  122. CURRENT_TIME([precision]) <1>
  123. CURTIME
  124. --------------------------------------------------
  125. *Input*:
  126. <1> fractional digits; optional
  127. *Output*: time
  128. *Description*: Returns the time when the current query reached the server.
  129. As a function, `CURRENT_TIME()` accepts _precision_ as an optional
  130. parameter for rounding the second fractional digits (nanoseconds). The default _precision_ is 3,
  131. meaning a milliseconds precision current time will be returned.
  132. This method always returns the same value for its every occurrence within the same query.
  133. [source, sql]
  134. --------------------------------------------------
  135. include-tagged::{sql-specs}/docs/docs.csv-spec[currentTime]
  136. --------------------------------------------------
  137. [source, sql]
  138. --------------------------------------------------
  139. include-tagged::{sql-specs}/docs/docs.csv-spec[currentTimeFunction]
  140. --------------------------------------------------
  141. [source, sql]
  142. --------------------------------------------------
  143. include-tagged::{sql-specs}/docs/docs.csv-spec[curTimeFunction]
  144. --------------------------------------------------
  145. [source, sql]
  146. --------------------------------------------------
  147. include-tagged::{sql-specs}/docs/docs.csv-spec[currentTimeFunctionPrecision]
  148. --------------------------------------------------
  149. Typically, this function is used for relative date/time filtering:
  150. [source, sql]
  151. --------------------------------------------------
  152. include-tagged::{sql-specs}/docs/docs.csv-spec[filterCurrentTime]
  153. --------------------------------------------------
  154. [IMPORTANT]
  155. Currently, using a _precision_ greater than 6 doesn't make any difference to the output of the
  156. function as the maximum number of second fractional digits returned is 6.
  157. [[sql-functions-current-timestamp]]
  158. ==== `CURRENT_TIMESTAMP`
  159. .Synopsis:
  160. [source, sql]
  161. --------------------------------------------------
  162. CURRENT_TIMESTAMP
  163. CURRENT_TIMESTAMP([precision]) <1>
  164. --------------------------------------------------
  165. *Input*:
  166. <1> fractional digits; optional
  167. *Output*: date/time
  168. *Description*: Returns the date/time when the current query reached the server.
  169. As a function, `CURRENT_TIMESTAMP()` accepts _precision_ as an optional
  170. parameter for rounding the second fractional digits (nanoseconds). The default _precision_ is 3,
  171. meaning a milliseconds precision current date/time will be returned.
  172. This method always returns the same value for its every occurrence within the same query.
  173. [source, sql]
  174. --------------------------------------------------
  175. include-tagged::{sql-specs}/docs/docs.csv-spec[curTs]
  176. --------------------------------------------------
  177. [source, sql]
  178. --------------------------------------------------
  179. include-tagged::{sql-specs}/docs/docs.csv-spec[curTsFunction]
  180. --------------------------------------------------
  181. [source, sql]
  182. --------------------------------------------------
  183. include-tagged::{sql-specs}/docs/docs.csv-spec[curTsFunctionPrecision]
  184. --------------------------------------------------
  185. Typically, this function (as well as its twin <<sql-functions-now,NOW())>> function is used for
  186. relative date/time filtering:
  187. [source, sql]
  188. --------------------------------------------------
  189. include-tagged::{sql-specs}/docs/docs.csv-spec[filterNow]
  190. --------------------------------------------------
  191. [IMPORTANT]
  192. Currently, using a _precision_ greater than 6 doesn't make any difference to the output of the
  193. function as the maximum number of second fractional digits returned is 6.
  194. [[sql-functions-datetime-add]]
  195. ==== `DATE_ADD/DATEADD/TIMESTAMP_ADD/TIMESTAMPADD`
  196. .Synopsis:
  197. [source, sql]
  198. --------------------------------------------------
  199. DATE_ADD(
  200. string_exp, <1>
  201. integer_exp, <2>
  202. datetime_exp) <3>
  203. --------------------------------------------------
  204. *Input*:
  205. <1> string expression denoting the date/time unit to add to the date/datetime.
  206. If `null`, the function returns `null`.
  207. <2> integer expression denoting how many times the above unit should be added
  208. to/from the date/datetime, if a negative value is used it results to a
  209. subtraction from the date/datetime. If `null`, the function returns `null`.
  210. <3> date/datetime expression. If `null`, the function returns `null`.
  211. *Output*: datetime
  212. *Description*: Add the given number of date/time units to a date/datetime. If the number of units is negative then it's subtracted from
  213. the date/datetime.
  214. [WARNING]
  215. If the second argument is a long there is possibility of truncation since an integer value will be extracted and
  216. used from that long.
  217. [cols="^,^"]
  218. |===
  219. 2+h|Datetime units to add/subtract
  220. s|unit
  221. s|abbreviations
  222. | year | years, yy, yyyy
  223. | quarter | quarters, qq, q
  224. | month | months, mm, m
  225. | dayofyear | dy, y
  226. | day | days, dd, d
  227. | week | weeks, wk, ww
  228. | weekday | weekdays, dw
  229. | hour | hours, hh
  230. | minute | minutes, mi, n
  231. | second | seconds, ss, s
  232. | millisecond | milliseconds, ms
  233. | microsecond | microseconds, mcs
  234. | nanosecond | nanoseconds, ns
  235. |===
  236. [source, sql]
  237. --------------------------------------------------
  238. include-tagged::{sql-specs}/docs/docs.csv-spec[dateAddDateTimeYears]
  239. --------------------------------------------------
  240. [source, sql]
  241. --------------------------------------------------
  242. include-tagged::{sql-specs}/docs/docs.csv-spec[dateAddDateTimeWeeks]
  243. --------------------------------------------------
  244. [source, sql]
  245. --------------------------------------------------
  246. include-tagged::{sql-specs}/docs/docs.csv-spec[dateAddDateTimeSeconds]
  247. --------------------------------------------------
  248. [source, sql]
  249. --------------------------------------------------
  250. include-tagged::{sql-specs}/docs/docs.csv-spec[dateAddDateQuarters]
  251. --------------------------------------------------
  252. [source, sql]
  253. --------------------------------------------------
  254. include-tagged::{sql-specs}/docs/docs.csv-spec[dateAddDateMinutes]
  255. --------------------------------------------------
  256. [[sql-functions-datetime-diff]]
  257. ==== `DATE_DIFF/DATEDIFF/TIMESTAMP_DIFF/TIMESTAMPDIFF`
  258. .Synopsis:
  259. [source, sql]
  260. --------------------------------------------------
  261. DATE_DIFF(
  262. string_exp, <1>
  263. datetime_exp, <2>
  264. datetime_exp) <3>
  265. --------------------------------------------------
  266. *Input*:
  267. <1> string expression denoting the date/time unit difference between the
  268. following two date/datetime expressions. If `null`, the function returns `null`.
  269. <2> start date/datetime expression. If `null`, the function returns `null`.
  270. <3> end date/datetime expression. If `null`, the function returns `null`.
  271. *Output*: integer
  272. *Description*: Subtract the second argument from the third argument and return their difference in multiples of the unit
  273. specified in the first argument. If the second argument (start) is greater than the third argument (end),
  274. then negative values are returned.
  275. [cols="^,^"]
  276. |===
  277. 2+h|Datetime difference units
  278. s|unit
  279. s|abbreviations
  280. | year | years, yy, yyyy
  281. | quarter | quarters, qq, q
  282. | month | months, mm, m
  283. | dayofyear | dy, y
  284. | day | days, dd, d
  285. | week | weeks, wk, ww
  286. | weekday | weekdays, dw
  287. | hour | hours, hh
  288. | minute | minutes, mi, n
  289. | second | seconds, ss, s
  290. | millisecond | milliseconds, ms
  291. | microsecond | microseconds, mcs
  292. | nanosecond | nanoseconds, ns
  293. |===
  294. [source, sql]
  295. --------------------------------------------------
  296. include-tagged::{sql-specs}/docs/docs.csv-spec[dateDiffDateTimeYears]
  297. --------------------------------------------------
  298. [source, sql]
  299. --------------------------------------------------
  300. include-tagged::{sql-specs}/docs/docs.csv-spec[dateDiffDateTimeWeeks]
  301. --------------------------------------------------
  302. [source, sql]
  303. --------------------------------------------------
  304. include-tagged::{sql-specs}/docs/docs.csv-spec[dateDiffDateTimeSeconds]
  305. --------------------------------------------------
  306. [source, sql]
  307. --------------------------------------------------
  308. include-tagged::{sql-specs}/docs/docs.csv-spec[dateDiffDateQuarters]
  309. --------------------------------------------------
  310. [NOTE]
  311. For `hour` and `minute`, `DATEDIFF` doesn't do any rounding, but instead first truncates
  312. the more detailed time fields on the 2 dates to zero and then calculates the subtraction.
  313. [source, sql]
  314. --------------------------------------------------
  315. include-tagged::{sql-specs}/docs/docs.csv-spec[dateDiffDateTimeHours]
  316. --------------------------------------------------
  317. [source, sql]
  318. --------------------------------------------------
  319. include-tagged::{sql-specs}/docs/docs.csv-spec[dateDiffDateTimeMinutes]
  320. --------------------------------------------------
  321. [source, sql]
  322. --------------------------------------------------
  323. include-tagged::{sql-specs}/docs/docs.csv-spec[dateDiffDateMinutes]
  324. --------------------------------------------------
  325. [[sql-functions-datetime-dateparse]]
  326. ==== `DATE_PARSE`
  327. .Synopsis:
  328. [source, sql]
  329. --------------------------------------------------
  330. DATE_PARSE(
  331. string_exp, <1>
  332. string_exp) <2>
  333. --------------------------------------------------
  334. *Input*:
  335. <1> date expression as a string. If `null` or an empty string, the function
  336. returns `null`.
  337. <2> parsing pattern. If `null` or an empty string, the function returns `null`.
  338. *Output*: date
  339. *Description*: Returns a date by parsing the 1st argument using the format specified in the 2nd argument. The parsing
  340. format pattern used is the one from
  341. https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/time/format/DateTimeFormatter.html[`java.time.format.DateTimeFormatter`].
  342. [NOTE]
  343. If the parsing pattern does not contain all valid date units (e.g. 'HH:mm:ss', 'dd-MM HH:mm:ss', etc.) an error is returned
  344. as the function needs to return a value of `date` type which will contain date part.
  345. [source, sql]
  346. --------------------------------------------------
  347. include-tagged::{sql-specs}/docs/docs.csv-spec[dateParse1]
  348. --------------------------------------------------
  349. [NOTE]
  350. ====
  351. The resulting `date` will have the time zone specified by the user through the
  352. <<sql-search-api-time-zone,`time_zone`>>/<<jdbc-cfg-timezone,`timezone`>> REST/driver parameters
  353. with no conversion applied.
  354. [source, sql]
  355. --------------------------------------------------
  356. include-tagged::{sql-specs}/docs/docs.csv-spec[dateParse2]
  357. --------------------------------------------------
  358. ====
  359. [[sql-functions-datetime-datetimeformat]]
  360. ==== `DATETIME_FORMAT`
  361. .Synopsis:
  362. [source, sql]
  363. --------------------------------------------------
  364. DATETIME_FORMAT(
  365. date_exp/datetime_exp/time_exp, <1>
  366. string_exp) <2>
  367. --------------------------------------------------
  368. *Input*:
  369. <1> date/datetime/time expression. If `null`, the function returns `null`.
  370. <2> format pattern. If `null` or an empty string, the function returns `null`.
  371. *Output*: string
  372. *Description*: Returns the date/datetime/time as a string using the format specified in the 2nd argument. The formatting
  373. pattern used is the one from
  374. https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/time/format/DateTimeFormatter.html[`java.time.format.DateTimeFormatter`].
  375. [NOTE]
  376. If the 1st argument is of type `time`, then pattern specified by the 2nd argument cannot contain date related units
  377. (e.g. 'dd', 'MM', 'yyyy', etc.). If it contains such units an error is returned.
  378. [source, sql]
  379. --------------------------------------------------
  380. include-tagged::{sql-specs}/docs/docs.csv-spec[dateTimeFormatDate]
  381. --------------------------------------------------
  382. [source, sql]
  383. --------------------------------------------------
  384. include-tagged::{sql-specs}/docs/docs.csv-spec[dateTimeFormatDateTime]
  385. --------------------------------------------------
  386. [source, sql]
  387. --------------------------------------------------
  388. include-tagged::{sql-specs}/docs/docs.csv-spec[dateTimeFormatTime]
  389. --------------------------------------------------
  390. [[sql-functions-datetime-datetimeparse]]
  391. ==== `DATETIME_PARSE`
  392. .Synopsis:
  393. [source, sql]
  394. --------------------------------------------------
  395. DATETIME_PARSE(
  396. string_exp, <1>
  397. string_exp) <2>
  398. --------------------------------------------------
  399. *Input*:
  400. <1> datetime expression as a string. If `null` or an empty string, the function
  401. returns `null`.
  402. <2> parsing pattern. If `null` or an empty string, the function returns `null`.
  403. *Output*: datetime
  404. *Description*: Returns a datetime by parsing the 1st argument using the format specified in the 2nd argument. The parsing
  405. format pattern used is the one from
  406. https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/time/format/DateTimeFormatter.html[`java.time.format.DateTimeFormatter`].
  407. [NOTE]
  408. If the parsing pattern contains only date or only time units (e.g. 'dd/MM/yyyy', 'HH:mm:ss', etc.) an error is returned
  409. as the function needs to return a value of `datetime` type which must contain both.
  410. [source, sql]
  411. --------------------------------------------------
  412. include-tagged::{sql-specs}/docs/docs.csv-spec[dateTimeParse1]
  413. --------------------------------------------------
  414. [source, sql]
  415. --------------------------------------------------
  416. include-tagged::{sql-specs}/docs/docs.csv-spec[dateTimeParse2]
  417. --------------------------------------------------
  418. [NOTE]
  419. ====
  420. If timezone is not specified in the datetime string expression and the parsing pattern, the resulting `datetime` will have the
  421. time zone specified by the user through the <<sql-search-api-time-zone,`time_zone`>>/<<jdbc-cfg-timezone,`timezone`>> REST/driver parameters
  422. with no conversion applied.
  423. [source, sql]
  424. --------------------------------------------------
  425. include-tagged::{sql-specs}/docs/docs.csv-spec[dateTimeParse3]
  426. --------------------------------------------------
  427. ====
  428. [[sql-functions-datetime-timeparse]]
  429. ==== `TIME_PARSE`
  430. .Synopsis:
  431. [source, sql]
  432. --------------------------------------------------
  433. TIME_PARSE(
  434. string_exp, <1>
  435. string_exp) <2>
  436. --------------------------------------------------
  437. *Input*:
  438. <1> time expression as a string. If `null` or an empty string, the function
  439. returns `null`.
  440. <2> parsing pattern. If `null` or an empty string, the function returns `null`.
  441. *Output*: time
  442. *Description*: Returns a time by parsing the 1st argument using the format specified in the 2nd argument. The parsing
  443. format pattern used is the one from
  444. https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/time/format/DateTimeFormatter.html[`java.time.format.DateTimeFormatter`].
  445. [NOTE]
  446. If the parsing pattern contains only date units (e.g. 'dd/MM/yyyy') an error is returned
  447. as the function needs to return a value of `time` type which will contain only time.
  448. [source, sql]
  449. --------------------------------------------------
  450. include-tagged::{sql-specs}/docs/docs.csv-spec[timeParse1]
  451. --------------------------------------------------
  452. [source, sql]
  453. --------------------------------------------------
  454. include-tagged::{sql-specs}/docs/docs.csv-spec[timeParse2]
  455. --------------------------------------------------
  456. [NOTE]
  457. ====
  458. If timezone is not specified in the time string expression and the parsing pattern,
  459. the resulting `time` will have the offset of the time zone specified by the user through the
  460. <<sql-search-api-time-zone,`time_zone`>>/<<jdbc-cfg-timezone,`timezone`>> REST/driver
  461. parameters at the Unix epoch date (`1970-01-01`) with no conversion applied.
  462. [source, sql]
  463. --------------------------------------------------
  464. include-tagged::{sql-specs}/docs/docs.csv-spec[timeParse3]
  465. --------------------------------------------------
  466. ====
  467. [[sql-functions-datetime-part]]
  468. ==== `DATE_PART/DATEPART`
  469. .Synopsis:
  470. [source, sql]
  471. --------------------------------------------------
  472. DATE_PART(
  473. string_exp, <1>
  474. datetime_exp) <2>
  475. --------------------------------------------------
  476. *Input*:
  477. <1> string expression denoting the unit to extract from the date/datetime. If
  478. `null`, the function returns `null`.
  479. <2> date/datetime expression. If `null`, the function returns `null`.
  480. *Output*: integer
  481. *Description*: Extract the specified unit from a date/datetime. It's similar to
  482. <<sql-functions-datetime-extract>> but with different names and aliases for the
  483. units and provides more options (e.g.: `TZOFFSET`).
  484. [cols="^,^"]
  485. |===
  486. 2+h|Datetime units to extract
  487. s|unit
  488. s|abbreviations
  489. | year | years, yy, yyyy
  490. | quarter | quarters, qq, q
  491. | month | months, mm, m
  492. | dayofyear | dy, y
  493. | day | days, dd, d
  494. | week | weeks, wk, ww
  495. | weekday | weekdays, dw
  496. | hour | hours, hh
  497. | minute | minutes, mi, n
  498. | second | seconds, ss, s
  499. | millisecond | milliseconds, ms
  500. | microsecond | microseconds, mcs
  501. | nanosecond | nanoseconds, ns
  502. | tzoffset | tz
  503. |===
  504. [source, sql]
  505. --------------------------------------------------
  506. include-tagged::{sql-specs}/docs/docs.csv-spec[datePartDateTimeYears]
  507. --------------------------------------------------
  508. [source, sql]
  509. --------------------------------------------------
  510. include-tagged::{sql-specs}/docs/docs.csv-spec[datePartDateTimeMinutes]
  511. --------------------------------------------------
  512. [source, sql]
  513. --------------------------------------------------
  514. include-tagged::{sql-specs}/docs/docs.csv-spec[datePartDateQuarter]
  515. --------------------------------------------------
  516. [source, sql]
  517. --------------------------------------------------
  518. include-tagged::{sql-specs}/docs/docs.csv-spec[datePartDateMonth]
  519. --------------------------------------------------
  520. [NOTE]
  521. For `week` and `weekday` the unit is extracted using the non-ISO calculation, which means
  522. that a given week is considered to start from Sunday, not Monday.
  523. [source, sql]
  524. --------------------------------------------------
  525. include-tagged::{sql-specs}/docs/docs.csv-spec[datePartDateTimeWeek]
  526. --------------------------------------------------
  527. [NOTE]
  528. The `tzoffset` returns the total number of minutes (signed) that represent the time zone's offset.
  529. [source, sql]
  530. --------------------------------------------------
  531. include-tagged::{sql-specs}/docs/docs.csv-spec[datePartDateTimeTzOffsetPlus]
  532. --------------------------------------------------
  533. [source, sql]
  534. --------------------------------------------------
  535. include-tagged::{sql-specs}/docs/docs.csv-spec[datePartDateTimeTzOffsetMinus]
  536. --------------------------------------------------
  537. [[sql-functions-datetime-trunc]]
  538. ==== `DATE_TRUNC/DATETRUNC`
  539. .Synopsis:
  540. [source, sql]
  541. --------------------------------------------------
  542. DATE_TRUNC(
  543. string_exp, <1>
  544. datetime_exp/interval_exp) <2>
  545. --------------------------------------------------
  546. *Input*:
  547. <1> string expression denoting the unit to which the date/datetime/interval
  548. should be truncated to. If `null`, the function returns `null`.
  549. <2> date/datetime/interval expression. If `null`, the function returns `null`.
  550. *Output*: datetime/interval
  551. *Description*: Truncate the date/datetime/interval to the specified unit by
  552. setting all fields that are less significant than the specified one to zero (or
  553. one, for day, day of week and month). If the first argument is `week` and the
  554. second argument is of `interval` type, an error is thrown since the `interval`
  555. data type doesn't support a `week` time unit.
  556. [cols="^,^"]
  557. |===
  558. 2+h|Datetime truncation units
  559. s|unit
  560. s|abbreviations
  561. | millennium | millennia
  562. | century | centuries
  563. | decade | decades
  564. | year | years, yy, yyyy
  565. | quarter | quarters, qq, q
  566. | month | months, mm, m
  567. | week | weeks, wk, ww
  568. | day | days, dd, d
  569. | hour | hours, hh
  570. | minute | minutes, mi, n
  571. | second | seconds, ss, s
  572. | millisecond | milliseconds, ms
  573. | microsecond | microseconds, mcs
  574. | nanosecond | nanoseconds, ns
  575. |===
  576. [source, sql]
  577. --------------------------------------------------
  578. include-tagged::{sql-specs}/docs/docs.csv-spec[truncateDateTimeMillennium]
  579. --------------------------------------------------
  580. [source, sql]
  581. --------------------------------------------------
  582. include-tagged::{sql-specs}/docs/docs.csv-spec[truncateDateTimeWeek]
  583. --------------------------------------------------
  584. [source, sql]
  585. --------------------------------------------------
  586. include-tagged::{sql-specs}/docs/docs.csv-spec[truncateDateTimeMinutes]
  587. --------------------------------------------------
  588. [source, sql]
  589. --------------------------------------------------
  590. include-tagged::{sql-specs}/docs/docs.csv-spec[truncateDateDecades]
  591. --------------------------------------------------
  592. [source, sql]
  593. --------------------------------------------------
  594. include-tagged::{sql-specs}/docs/docs.csv-spec[truncateDateQuarter]
  595. --------------------------------------------------
  596. [source, sql]
  597. --------------------------------------------------
  598. include-tagged::{sql-specs}/docs/docs.csv-spec[truncateIntervalCenturies]
  599. --------------------------------------------------
  600. [source, sql]
  601. --------------------------------------------------
  602. include-tagged::{sql-specs}/docs/docs.csv-spec[truncateIntervalHour]
  603. --------------------------------------------------
  604. [source, sql]
  605. --------------------------------------------------
  606. include-tagged::{sql-specs}/docs/docs.csv-spec[truncateIntervalDay]
  607. --------------------------------------------------
  608. [[sql-functions-datetime-format]]
  609. ==== `FORMAT`
  610. .Synopsis:
  611. [source, sql]
  612. --------------------------------------------------
  613. FORMAT(
  614. date_exp/datetime_exp/time_exp, <1>
  615. string_exp) <2>
  616. --------------------------------------------------
  617. *Input*:
  618. <1> date/datetime/time expression. If `null`, the function returns `null`.
  619. <2> format pattern. If `null` or an empty string, the function returns `null`.
  620. *Output*: string
  621. *Description*: Returns the date/datetime/time as a string using the
  622. https://docs.microsoft.com/en-us/sql/t-sql/functions/format-transact-sql#arguments[format]
  623. specified in the 2nd argument. The formatting pattern used is the one from
  624. https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings[Microsoft
  625. SQL Server Format Specification].
  626. [NOTE]
  627. If the 1st argument is of type `time`, then pattern specified by the 2nd argument cannot contain date related units
  628. (e.g. 'dd', 'MM', 'YYYY', etc.). If it contains such units an error is returned. +
  629. Format specifier `F` will be working similar to format specifier `f`.
  630. It will return the fractional part of seconds, and the number of digits will be same as of the number of `Fs` provided as input (up to 9 digits).
  631. Result will contain `0` appended in the end to match with number of `F` provided.
  632. e.g.: for a time part `10:20:30.1234` and pattern `HH:mm:ss.FFFFFF`, the output string of the function would be: `10:20:30.123400`. +
  633. Format specifier `y` will return year-of-era instead of one/two low-order digits.
  634. eg.: For year `2009`, `y` will be returning `2009` instead of `9`. For year `43`, `y` format specifier will return `43`.
  635. - Special characters like `"` , `\` and `%` will be returned as it is without any change. eg.: formatting date `17-sep-2020` with `%M` will return `%9`
  636. [source, sql]
  637. --------------------------------------------------
  638. include-tagged::{sql-specs}/docs/docs.csv-spec[formatDate]
  639. --------------------------------------------------
  640. [source, sql]
  641. --------------------------------------------------
  642. include-tagged::{sql-specs}/docs/docs.csv-spec[formatDateTime]
  643. --------------------------------------------------
  644. [source, sql]
  645. --------------------------------------------------
  646. include-tagged::{sql-specs}/docs/docs.csv-spec[formatTime]
  647. --------------------------------------------------
  648. [[sql-functions-datetime-to_char]]
  649. ==== `TO_CHAR`
  650. .Synopsis:
  651. [source, sql]
  652. --------------------------------------------------
  653. TO_CHAR(
  654. date_exp/datetime_exp/time_exp, <1>
  655. string_exp) <2>
  656. --------------------------------------------------
  657. *Input*:
  658. <1> date/datetime/time expression. If `null`, the function returns `null`.
  659. <2> format pattern. If `null` or an empty string, the function returns `null`.
  660. *Output*: string
  661. *Description*: Returns the date/datetime/time as a string using the format
  662. specified in the 2nd argument. The formatting pattern conforms to
  663. https://www.postgresql.org/docs/13/functions-formatting.html[PostgreSQL Template
  664. Patterns for Date/Time Formatting].
  665. [NOTE]
  666. If the 1st argument is of type `time`, then the pattern specified by the 2nd argument cannot contain date related units
  667. (e.g. 'dd', 'MM', 'YYYY', etc.). If it contains such units an error is returned. +
  668. The result of the patterns `TZ` and `tz` (time zone abbreviations) in some cases differ from the results returned by the `TO_CHAR`
  669. in PostgreSQL. The reason is that the time zone abbreviations specified by the JDK are different from the ones specified by PostgreSQL.
  670. This function might show an actual time zone abbreviation instead of the generic `LMT` or empty string or offset returned by the PostgreSQL
  671. implementation. The summer/daylight markers might also differ between the two implementations (e.g. will show `HT` instead of `HST`
  672. for Hawaii). +
  673. The `FX`, `TM`, `SP` pattern modifiers are not supported and will show up as `FX`, `TM`, `SP` literals in the output.
  674. [source, sql]
  675. --------------------------------------------------
  676. include-tagged::{sql-specs}/docs/docs.csv-spec[toCharDate]
  677. --------------------------------------------------
  678. [source, sql]
  679. --------------------------------------------------
  680. include-tagged::{sql-specs}/docs/docs.csv-spec[toCharDateTime]
  681. --------------------------------------------------
  682. [source, sql]
  683. --------------------------------------------------
  684. include-tagged::{sql-specs}/docs/docs.csv-spec[toCharTime]
  685. --------------------------------------------------
  686. [[sql-functions-datetime-day]]
  687. ==== `DAY_OF_MONTH/DOM/DAY`
  688. .Synopsis:
  689. [source, sql]
  690. --------------------------------------------------
  691. DAY_OF_MONTH(datetime_exp) <1>
  692. --------------------------------------------------
  693. *Input*:
  694. <1> date/datetime expression. If `null`, the function returns `null`.
  695. *Output*: integer
  696. *Description*: Extract the day of the month from a date/datetime.
  697. [source, sql]
  698. --------------------------------------------------
  699. include-tagged::{sql-specs}/docs/docs.csv-spec[dayOfMonth]
  700. --------------------------------------------------
  701. [[sql-functions-datetime-dow]]
  702. ==== `DAY_OF_WEEK/DAYOFWEEK/DOW`
  703. .Synopsis:
  704. [source, sql]
  705. --------------------------------------------------
  706. DAY_OF_WEEK(datetime_exp) <1>
  707. --------------------------------------------------
  708. *Input*:
  709. <1> date/datetime expression. If `null`, the function returns `null`.
  710. *Output*: integer
  711. *Description*: Extract the day of the week from a date/datetime. Sunday is `1`, Monday is `2`, etc.
  712. [source, sql]
  713. --------------------------------------------------
  714. include-tagged::{sql-specs}/docs/docs.csv-spec[dayOfWeek]
  715. --------------------------------------------------
  716. [[sql-functions-datetime-doy]]
  717. ==== `DAY_OF_YEAR/DOY`
  718. .Synopsis:
  719. [source, sql]
  720. --------------------------------------------------
  721. DAY_OF_YEAR(datetime_exp) <1>
  722. --------------------------------------------------
  723. *Input*:
  724. <1> date/datetime expression. If `null`, the function returns `null`.
  725. *Output*: integer
  726. *Description*: Extract the day of the year from a date/datetime.
  727. [source, sql]
  728. --------------------------------------------------
  729. include-tagged::{sql-specs}/docs/docs.csv-spec[dayOfYear]
  730. --------------------------------------------------
  731. [[sql-functions-datetime-dayname]]
  732. ==== `DAY_NAME/DAYNAME`
  733. .Synopsis:
  734. [source, sql]
  735. --------------------------------------------------
  736. DAY_NAME(datetime_exp) <1>
  737. --------------------------------------------------
  738. *Input*:
  739. <1> date/datetime expression. If `null`, the function returns `null`.
  740. *Output*: string
  741. *Description*: Extract the day of the week from a date/datetime in text format (`Monday`, `Tuesday`...).
  742. [source, sql]
  743. --------------------------------------------------
  744. include-tagged::{sql-specs}/docs/docs.csv-spec[dayName]
  745. --------------------------------------------------
  746. [[sql-functions-datetime-hour]]
  747. ==== `HOUR_OF_DAY/HOUR`
  748. .Synopsis:
  749. [source, sql]
  750. --------------------------------------------------
  751. HOUR_OF_DAY(datetime_exp) <1>
  752. --------------------------------------------------
  753. *Input*:
  754. <1> date/datetime expression. If `null`, the function returns `null`.
  755. *Output*: integer
  756. *Description*: Extract the hour of the day from a date/datetime.
  757. [source, sql]
  758. --------------------------------------------------
  759. include-tagged::{sql-specs}/docs/docs.csv-spec[hourOfDay]
  760. --------------------------------------------------
  761. [[sql-functions-datetime-isodow]]
  762. ==== `ISO_DAY_OF_WEEK/ISODAYOFWEEK/ISODOW/IDOW`
  763. .Synopsis:
  764. [source, sql]
  765. --------------------------------------------------
  766. ISO_DAY_OF_WEEK(datetime_exp) <1>
  767. --------------------------------------------------
  768. *Input*:
  769. <1> date/datetime expression. If `null`, the function returns `null`.
  770. *Output*: integer
  771. *Description*: Extract the day of the week from a date/datetime, following the {wikipedia}/ISO_week_date[ISO 8601 standard].
  772. Monday is `1`, Tuesday is `2`, etc.
  773. [source, sql]
  774. --------------------------------------------------
  775. include-tagged::{sql-specs}/docs/docs.csv-spec[isoDayOfWeek]
  776. --------------------------------------------------
  777. [[sql-functions-datetime-isoweek]]
  778. ==== `ISO_WEEK_OF_YEAR/ISOWEEKOFYEAR/ISOWEEK/IWOY/IW`
  779. .Synopsis:
  780. [source, sql]
  781. --------------------------------------------------
  782. ISO_WEEK_OF_YEAR(datetime_exp) <1>
  783. --------------------------------------------------
  784. *Input*:
  785. <1> date/datetime expression. If `null`, the function returns `null`.
  786. *Output*: integer
  787. *Description*: Extract the week of the year from a date/datetime, following {wikipedia}/ISO_week_date[ISO 8601 standard]. The first week
  788. of a year is the first week with a majority (4 or more) of its days in January.
  789. [source, sql]
  790. --------------------------------------------------
  791. include-tagged::{sql-specs}/docs/docs.csv-spec[isoWeekOfYear]
  792. --------------------------------------------------
  793. [[sql-functions-datetime-minuteofday]]
  794. ==== `MINUTE_OF_DAY`
  795. .Synopsis:
  796. [source, sql]
  797. --------------------------------------------------
  798. MINUTE_OF_DAY(datetime_exp) <1>
  799. --------------------------------------------------
  800. *Input*:
  801. <1> date/datetime expression. If `null`, the function returns `null`.
  802. *Output*: integer
  803. *Description*: Extract the minute of the day from a date/datetime.
  804. [source, sql]
  805. --------------------------------------------------
  806. include-tagged::{sql-specs}/docs/docs.csv-spec[minuteOfDay]
  807. --------------------------------------------------
  808. [[sql-functions-datetime-minute]]
  809. ==== `MINUTE_OF_HOUR/MINUTE`
  810. .Synopsis:
  811. [source, sql]
  812. --------------------------------------------------
  813. MINUTE_OF_HOUR(datetime_exp) <1>
  814. --------------------------------------------------
  815. *Input*:
  816. <1> date/datetime expression. If `null`, the function returns `null`.
  817. *Output*: integer
  818. *Description*: Extract the minute of the hour from a date/datetime.
  819. [source, sql]
  820. --------------------------------------------------
  821. include-tagged::{sql-specs}/docs/docs.csv-spec[minuteOfHour]
  822. --------------------------------------------------
  823. [[sql-functions-datetime-month]]
  824. ==== `MONTH_OF_YEAR/MONTH`
  825. .Synopsis:
  826. [source, sql]
  827. --------------------------------------------------
  828. MONTH(datetime_exp) <1>
  829. --------------------------------------------------
  830. *Input*:
  831. <1> date/datetime expression. If `null`, the function returns `null`.
  832. *Output*: integer
  833. *Description*: Extract the month of the year from a date/datetime.
  834. [source, sql]
  835. --------------------------------------------------
  836. include-tagged::{sql-specs}/docs/docs.csv-spec[monthOfYear]
  837. --------------------------------------------------
  838. [[sql-functions-datetime-monthname]]
  839. ==== `MONTH_NAME/MONTHNAME`
  840. .Synopsis:
  841. [source, sql]
  842. --------------------------------------------------
  843. MONTH_NAME(datetime_exp) <1>
  844. --------------------------------------------------
  845. *Input*:
  846. <1> date/datetime expression. If `null`, the function returns `null`.
  847. *Output*: string
  848. *Description*: Extract the month from a date/datetime in text format (`January`, `February`...).
  849. [source, sql]
  850. --------------------------------------------------
  851. include-tagged::{sql-specs}/docs/docs.csv-spec[monthName]
  852. --------------------------------------------------
  853. [[sql-functions-now]]
  854. ==== `NOW`
  855. .Synopsis:
  856. [source, sql]
  857. --------------------------------------------------
  858. NOW()
  859. --------------------------------------------------
  860. *Input*: _none_
  861. *Output*: datetime
  862. *Description*: This function offers the same functionality as <<sql-functions-current-timestamp,CURRENT_TIMESTAMP()>> function: returns
  863. the datetime when the current query reached the server. This method always returns the same value for its every
  864. occurrence within the same query.
  865. [source, sql]
  866. --------------------------------------------------
  867. include-tagged::{sql-specs}/docs/docs.csv-spec[nowFunction]
  868. --------------------------------------------------
  869. Typically, this function (as well as its twin <<sql-functions-current-timestamp,CURRENT_TIMESTAMP())>> function is used
  870. for relative date/time filtering:
  871. [source, sql]
  872. --------------------------------------------------
  873. include-tagged::{sql-specs}/docs/docs.csv-spec[filterNow]
  874. --------------------------------------------------
  875. [[sql-functions-datetime-second]]
  876. ==== `SECOND_OF_MINUTE/SECOND`
  877. .Synopsis:
  878. [source, sql]
  879. --------------------------------------------------
  880. SECOND_OF_MINUTE(datetime_exp) <1>
  881. --------------------------------------------------
  882. *Input*:
  883. <1> date/datetime expression. If `null`, the function returns `null`.
  884. *Output*: integer
  885. *Description*: Extract the second of the minute from a date/datetime.
  886. [source, sql]
  887. --------------------------------------------------
  888. include-tagged::{sql-specs}/docs/docs.csv-spec[secondOfMinute]
  889. --------------------------------------------------
  890. [[sql-functions-datetime-quarter]]
  891. ==== `QUARTER`
  892. .Synopsis:
  893. [source, sql]
  894. --------------------------------------------------
  895. QUARTER(datetime_exp) <1>
  896. --------------------------------------------------
  897. *Input*:
  898. <1> date/datetime expression. If `null`, the function returns `null`.
  899. *Output*: integer
  900. *Description*: Extract the year quarter the date/datetime falls in.
  901. [source, sql]
  902. --------------------------------------------------
  903. include-tagged::{sql-specs}/docs/docs.csv-spec[quarter]
  904. --------------------------------------------------
  905. [[sql-functions-today]]
  906. ==== `TODAY`
  907. .Synopsis:
  908. [source, sql]
  909. --------------------------------------------------
  910. TODAY()
  911. --------------------------------------------------
  912. *Input*: _none_
  913. *Output*: date
  914. *Description*: This function offers the same functionality as <<sql-functions-current-date,CURRENT_DATE()>> function: returns
  915. the date when the current query reached the server. This method always returns the same value for its every occurrence
  916. within the same query.
  917. [source, sql]
  918. --------------------------------------------------
  919. include-tagged::{sql-specs}/docs/docs.csv-spec[todayFunction]
  920. --------------------------------------------------
  921. Typically, this function (as well as its twin <<sql-functions-current-timestamp,CURRENT_TIMESTAMP())>> function is used
  922. for relative date filtering:
  923. [source, sql]
  924. --------------------------------------------------
  925. include-tagged::{sql-specs}/docs/docs.csv-spec[filterToday]
  926. --------------------------------------------------
  927. [[sql-functions-datetime-week]]
  928. ==== `WEEK_OF_YEAR/WEEK`
  929. .Synopsis:
  930. [source, sql]
  931. --------------------------------------------------
  932. WEEK_OF_YEAR(datetime_exp) <1>
  933. --------------------------------------------------
  934. *Input*:
  935. <1> date/datetime expression. If `null`, the function returns `null`.
  936. *Output*: integer
  937. *Description*: Extract the week of the year from a date/datetime.
  938. [source, sql]
  939. --------------------------------------------------
  940. include-tagged::{sql-specs}/docs/docs.csv-spec[weekOfYear]
  941. --------------------------------------------------
  942. [[sql-functions-datetime-year]]
  943. ==== `YEAR`
  944. .Synopsis:
  945. [source, sql]
  946. --------------------------------------------------
  947. YEAR(datetime_exp) <1>
  948. --------------------------------------------------
  949. *Input*:
  950. <1> date/datetime expression. If `null`, the function returns `null`.
  951. *Output*: integer
  952. *Description*: Extract the year from a date/datetime.
  953. [source, sql]
  954. --------------------------------------------------
  955. include-tagged::{sql-specs}/docs/docs.csv-spec[year]
  956. --------------------------------------------------
  957. [[sql-functions-datetime-extract]]
  958. ==== `EXTRACT`
  959. .Synopsis:
  960. [source, sql]
  961. --------------------------------------------------
  962. EXTRACT(
  963. datetime_function <1>
  964. FROM datetime_exp) <2>
  965. --------------------------------------------------
  966. *Input*:
  967. <1> date/time function name
  968. <2> date/datetime expression
  969. *Output*: integer
  970. *Description*: Extract fields from a date/datetime by specifying the name of a <<sql-functions-datetime,datetime function>>.
  971. The following
  972. [source, sql]
  973. --------------------------------------------------
  974. include-tagged::{sql-specs}/docs/docs.csv-spec[extractDayOfYear]
  975. --------------------------------------------------
  976. is the equivalent to
  977. [source, sql]
  978. --------------------------------------------------
  979. include-tagged::{sql-specs}/docs/docs.csv-spec[dayOfYear]
  980. --------------------------------------------------