mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Alias added and function name changed to timeZoneOffset
Changed links to russian Wikipedia
This commit is contained in:
parent
df2ef72d98
commit
06fbf600e7
@ -134,7 +134,7 @@ Result:
|
||||
└───────────────────┘
|
||||
```
|
||||
|
||||
## timezoneOffset {#timezoneoffset}
|
||||
## timeZoneOffset {#timezoneoffset}
|
||||
|
||||
Returns a timezone offset in seconds from [UTC](https://en.wikipedia.org/wiki/Coordinated_Universal_Time). The function takes into account [daylight saving time](https://en.wikipedia.org/wiki/Daylight_saving_time) and historical timezone changes at the specified date and time.
|
||||
[IANA timezone database](https://www.iana.org/time-zones) is used to calculate the offset.
|
||||
@ -142,12 +142,14 @@ Returns a timezone offset in seconds from [UTC](https://en.wikipedia.org/wiki/Co
|
||||
**Syntax**
|
||||
|
||||
``` sql
|
||||
timezoneOffset(datetime)
|
||||
timeZoneOffset(value)
|
||||
```
|
||||
|
||||
Alias: `timezoneOffset`.
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `datetime` — Date and time. [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
|
||||
- `value` — Date and time. [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
|
||||
|
||||
**Returned value**
|
||||
|
||||
@ -161,7 +163,7 @@ Query:
|
||||
|
||||
``` sql
|
||||
SELECT toDateTime('2021-04-21 10:20:30', 'America/New_York') AS Time, toTypeName(Time) AS Type,
|
||||
timezoneOffset(Time) AS Offset_in_seconds, (Offset_in_seconds / 3600) AS Offset_in_hours;
|
||||
timeZoneOffset(Time) AS Offset_in_seconds, (Offset_in_seconds / 3600) AS Offset_in_hours;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
@ -136,20 +136,22 @@ SELECT timezoneOf(now());
|
||||
└───────────────────┘
|
||||
```
|
||||
|
||||
## timezoneOffset {#timezoneoffset}
|
||||
## timeZoneOffset {#timezoneoffset}
|
||||
|
||||
Возвращает смещение часового пояса в секундах от [UTC](https://ru.wikipedia.org/wiki/%D0%92%D1%81%D0%B5%D0%BC%D0%B8%D1%80%D0%BD%D0%BE%D0%B5_%D0%BA%D0%BE%D0%BE%D1%80%D0%B4%D0%B8%D0%BD%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%BD%D0%BE%D0%B5_%D0%B2%D1%80%D0%B5%D0%BC%D1%8F). Функция учитывает [летнее время](https://ru.wikipedia.org/wiki/%D0%9B%D0%B5%D1%82%D0%BD%D0%B5%D0%B5_%D0%B2%D1%80%D0%B5%D0%BC%D1%8F) и исторические изменения часовых поясов, которые действовали на указанную дату.
|
||||
Возвращает смещение часового пояса в секундах от [UTC](https://ru.wikipedia.org/wiki/Всемирное_координированное_время). Функция учитывает [летнее время](https://ru.wikipedia.org/wiki/Летнее_время) и исторические изменения часовых поясов, которые действовали на указанную дату.
|
||||
Для вычисления смещения используется информация из [базы данных IANA](https://www.iana.org/time-zones).
|
||||
|
||||
**Синтаксис**
|
||||
|
||||
``` sql
|
||||
timezoneOffset(datetime)
|
||||
timeZoneOffset(value)
|
||||
```
|
||||
|
||||
Псевдоним: `timezoneOffset`.
|
||||
|
||||
**Аргументы**
|
||||
|
||||
- `datetime` — дата и время. [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
|
||||
- `value` — дата и время. [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
|
||||
|
||||
**Возвращаемое значение**
|
||||
|
||||
@ -163,7 +165,7 @@ timezoneOffset(datetime)
|
||||
|
||||
``` sql
|
||||
SELECT toDateTime('2021-04-21 10:20:30', 'Europe/Moscow') AS Time, toTypeName(Time) AS Type,
|
||||
timezoneOffset(Time) AS Offset_in_seconds, (Offset_in_seconds / 3600) AS Offset_in_hours;
|
||||
timeZoneOffset(Time) AS Offset_in_seconds, (Offset_in_seconds / 3600) AS Offset_in_hours;
|
||||
```
|
||||
|
||||
Результат:
|
||||
|
Loading…
Reference in New Issue
Block a user