Update example for date and time operator

Co-authored-by: Nikolai Kochetov <KochetovNicolai@users.noreply.github.com>
This commit is contained in:
Vladimir 2021-06-15 12:58:51 +03:00 committed by GitHub
parent 09ba2af5dc
commit cf2c3ee0d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 8 deletions

View File

@ -197,13 +197,16 @@ You can work with dates without using `INTERVAL`, just by adding or subtracting
Examples:
``` sql
SELECT now() AS current_date_time, current_date_time + 60*60*96;
SELECT
toDateTime('2014-10-26 00:00:00', 'Europe/Moscow') AS time,
time + 60 * 60 * 24 AS time_plus_24_hours,
time + toIntervalDay(1) AS time_plus_1_day
```
``` text
┌───current_date_time─┬─plus(now(), multiply(multiply(60, 60), 96))─┐
│ 2021-06-12 17:34:49 │ 2021-06-16 17:34:49
└─────────────────────┴─────────────────────────────────────────────┘
┌────────────────time─┬──time_plus_24_hours─┬─────time_plus_1_day─┐
│ 2014-10-26 00:00:00 │ 2014-10-26 23:00:00 │ 2014-10-27 00:00:00
└─────────────────────┴──────────────────────────────────────────┘
```
**See Also**

View File

@ -197,13 +197,16 @@ SELECT now() AS current_date_time, current_date_time + INTERVAL '4' day + INTERV
Пример:
``` sql
SELECT now() AS current_date_time, current_date_time + 60*60*96;
SELECT
toDateTime('2014-10-26 00:00:00', 'Europe/Moscow') AS time,
time + 60 * 60 * 24 AS time_plus_24_hours,
time + toIntervalDay(1) AS time_plus_1_day
```
``` text
┌───current_date_time─┬─plus(now(), multiply(multiply(60, 60), 96))─┐
│ 2021-06-12 17:34:49 │ 2021-06-16 17:34:49
└─────────────────────┴─────────────────────────────────────────────┘
┌────────────────time─┬──time_plus_24_hours─┬─────time_plus_1_day─┐
│ 2014-10-26 00:00:00 │ 2014-10-26 23:00:00 │ 2014-10-27 00:00:00
└─────────────────────┴──────────────────────────────────────────┘
```
**Смотрите также**