add cn/en docs for ignore_timezone description

This commit is contained in:
Ganlin Zhao 2022-12-05 12:32:00 +08:00
parent 470e0f2d23
commit 896921521f
2 changed files with 22 additions and 4 deletions

View File

@ -532,7 +532,12 @@ TIMEDIFF(expr1, expr2 [, time_unit])
#### TIMETRUNCATE
```sql
TIMETRUNCATE(expr, time_unit)
TIMETRUNCATE(expr, time_unit [, ignore_timezone])
ignore_timezone: {
0
| 1
}
```
**Description**: Truncate the input timestamp with unit specified by `time_unit`
@ -548,7 +553,10 @@ TIMETRUNCATE(expr, time_unit)
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
- 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.
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'.
Otherwise, TIMETRUNCATE('2020-01-01 23:00:00', 1d, 1) will return '2020-01-01 00:00:00'.
If `ignore_timezone` option is omitted, the default value is set to 1.
#### TIMEZONE

View File

@ -533,7 +533,12 @@ TIMEDIFF(expr1, expr2 [, time_unit])
#### TIMETRUNCATE
```sql
TIMETRUNCATE(expr, time_unit)
TIMETRUNCATE(expr, time_unit [, ignore_timezone])
ignore_timezone: {
0
| 1
}
```
**功能说明**:将时间戳按照指定时间单位 time_unit 进行截断。
@ -549,6 +554,11 @@ TIMETRUNCATE(expr, time_unit)
1b(纳秒), 1u(微秒)1a(毫秒)1s(秒)1m(分)1h(小时)1d(天), 1w(周)。
- 返回的时间戳精度与当前 DATABASE 设置的时间精度一致。
- 输入包含不符合时间日期格式的字符串则返回 NULL。
- 当使用 1d 作为时间单位对时间戳进行截断时, 可通过设置 ignore_timezone 参数指定返回结果的显示是否忽略客户端时区的影响。
例如客户端所配置时区为 UTC+0800, 则 TIMETRUNCATE('2020-01-01 23:00:00', 1d, 0) 返回结果为 '2020-01-01 08:00:00'。
而使用 TIMETRUNCATE('2020-01-01 23:00:00', 1d, 1) 设置忽略时区时,返回结果为 '2020-01-01 00:00:00'
ignore_timezone 如果忽略的话,则默认值为 1 。
#### TIMEZONE
@ -1085,7 +1095,7 @@ ignore_negative: {
```sql
DIFF(expr [, ignore_negative])
ignore_negative: {
0
| 1