fix: timetruncate doc issue

This commit is contained in:
dapan1121 2023-12-01 17:52:29 +08:00
parent 4d9211dcf1
commit 94cb3e3eb9
2 changed files with 1507 additions and 1505 deletions

View File

@ -626,9 +626,9 @@ TIMEDIFF(expr1, expr2 [, time_unit])
#### TIMETRUNCATE #### TIMETRUNCATE
```sql ```sql
TIMETRUNCATE(expr, time_unit [, ignore_timezone]) TIMETRUNCATE(expr, time_unit [, use_current_timezone])
ignore_timezone: { use_current_timezone: {
0 0
| 1 | 1
} }
@ -647,10 +647,11 @@ ignore_timezone: {
1b (nanoseconds), 1u (microseconds), 1a (milliseconds), 1s (seconds), 1m (minutes), 1h (hours), 1d (days), or 1w (weeks) 1b (nanoseconds), 1u (microseconds), 1a (milliseconds), 1s (seconds), 1m (minutes), 1h (hours), 1d (days), or 1w (weeks)
- The precision of the returned timestamp is same as the precision set for the current data base in use - The precision of the returned timestamp is same as the precision set for the current data base in use
- If the input data is not formatted as a timestamp, the returned value is null. - If the input data is not formatted as a timestamp, the returned value is null.
- If `1d` is used as `time_unit` to truncate the timestamp, `ignore_timezone` option can be set to indicate if the returned result is affected by client timezone or not. - When using 1d/1w as the time unit to truncate timestamp, you can specify whether to truncate based on the current time zone by setting the use_current_timezone parameter.
For example, if client timezone is set to UTC+0800, TIMETRUNCATE('2020-01-01 23:00:00', 1d, 0) will return '2020-01-01 08:00:00'. Value 0 indicates truncation using the UTC time zone, value 1 indicates truncation using the current time zone.
Otherwise, TIMETRUNCATE('2020-01-01 23:00:00', 1d, 1) will return '2020-01-01 00:00:00'. For example, if the time zone configured by the Client is UTC + 0800, TIMETRUNCATE ('2020-01-01 23:00:00', 1d, 0) returns the result of '2020-01-01 08:00:00'.
If `ignore_timezone` option is omitted, the default value is set to 1. When using TIMETRUNCATE ('2020-01-01 23:00:00', 1d, 1), the result is 2020-01-01 00:00:00 '.
When use_current_timezone is not specified, use_current_timezone defaults to 1.
#### TIMEZONE #### TIMEZONE

File diff suppressed because it is too large Load Diff