Description
Epic: Datetime remaining issues
Product: Tarantool
Since: 2.10
Audience/target: dev
Root document: https://www.tarantool.io/en/doc/latest/reference/reference_sql/
- https://www.tarantool.io/en/doc/latest/reference/reference_sql/sql_statements_and_clauses/#functions
- https://www.tarantool.io/en/doc/latest/reference/reference_sql/sql_user_guide/#operand-data-types
- https://www.tarantool.io/en/doc/latest/reference/reference_sql/sql_user_guide/#sql-data-type-conversion -- to check if there' a new content on type casting and to add info about casting of datetime/interval
SME: @ ImeevMA , @ tsafin
Dev. issue: tarantool/tarantool#6773
Documents with the input info:
- https://docs.google.com/document/d/1NlfSFB-pnxmpwcbAF0c7EYVaPoufFAg9Tbiyd1B9xtQ/edit#
- https://github.com/tarantool/tarantool/wiki/Datetime-Internals#datetime-in-sql
Below are contents of issues #2833 and #2832.
NOW()
Issue #2832.
The NOW() function returns the current date and time as a DATETIME
value. If this function is called more than once in a query, it returns
the same result until the query completes, unless a yield has occurred.
On yield the value returned by NOW() changes.
Requested by @ImeevMA in tarantool/tarantool@0243cdc.
DATE_PART()
Issue #2833.
The DATE_PART() function returns the requested information from a
DATETIME value. It takes two arguments, the first one tells us what
information is being requested, the second is a DATETIME value. Here is
a list of supported values of the first argument and what information is
returned:
'millennium' - milennium
'century' - century
'decade' - decade
'year' - year
'quarter' - quarter of year
'month' - month of year
'week' - week of year
'day' - day of month
'dow' - day of week
'doy' - day of year
'hour' - hour of day
'minute' - minute of hour
'second' - second of min
'millisecond' - millisecond of second
'microsecond' - microsecond of second
'nanosecond' - nanosecond of second
'epoch' - epoch
'timezone_offset' - timezone offset
Requested by @ImeevMA in tarantool/tarantool@90951de.