date_diff.asciidoc 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. // This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
  2. *Description*
  3. Subtracts the `startTimestamp` from the `endTimestamp` and returns the difference in multiples of `unit`. If `startTimestamp` is later than the `endTimestamp`, negative values are returned.
  4. [cols="^,^",role="styled"]
  5. |===
  6. 2+h|Datetime difference units
  7. s|unit
  8. s|abbreviations
  9. | year | years, yy, yyyy
  10. | quarter | quarters, qq, q
  11. | month | months, mm, m
  12. | dayofyear | dy, y
  13. | day | days, dd, d
  14. | week | weeks, wk, ww
  15. | weekday | weekdays, dw
  16. | hour | hours, hh
  17. | minute | minutes, mi, n
  18. | second | seconds, ss, s
  19. | millisecond | milliseconds, ms
  20. | microsecond | microseconds, mcs
  21. | nanosecond | nanoseconds, ns
  22. |===
  23. Note that while there is an overlap between the function's supported units and
  24. {esql}'s supported time span literals, these sets are distinct and not
  25. interchangeable. Similarly, the supported abbreviations are conveniently shared
  26. with implementations of this function in other established products and not
  27. necessarily common with the date-time nomenclature used by {es}.