mirror of
https://github.com/supabase/supabase.git
synced 2026-06-25 10:37:16 +08:00
119 lines
1.8 KiB
Plaintext
119 lines
1.8 KiB
Plaintext
---
|
|
id: changing-timezones
|
|
title: "Changing Timezones"
|
|
slug: changing-timezones
|
|
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/postgres.yml
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabsPanel from '@theme/TabsPanel';
|
|
|
|
Data types.
|
|
|
|
|
|
<Tabs
|
|
defaultActiveId="sql"
|
|
groupId="reference/postgres"
|
|
values={[{ label: 'SQL', value: 'sql' }]}>
|
|
|
|
<TabsPanel id="sql" label="sql">
|
|
|
|
```sql
|
|
alter database postgres
|
|
set timezone to 'America/New_York';
|
|
```
|
|
|
|
|
|
</TabsPanel>
|
|
|
|
</Tabs>
|
|
|
|
|
|
|
|
|
|
|
|
## Notes
|
|
|
|
- View a full list of timezones on [Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
### Change timezone
|
|
|
|
|
|
|
|
<Tabs
|
|
defaultActiveId="sql"
|
|
groupId="reference/postgres"
|
|
values={[{ label: 'SQL', value: 'sql' }]}>
|
|
|
|
<TabsPanel id="sql" label="sql">
|
|
|
|
```sql
|
|
alter database postgres
|
|
set timezone to 'America/New_York';
|
|
```
|
|
|
|
|
|
</TabsPanel>
|
|
|
|
</Tabs>
|
|
|
|
### Full list of timezones
|
|
|
|
Get a full list of timezones supported by your database. This will return the following columns:
|
|
|
|
- `name`: Time zone name
|
|
- `abbrev`: Time zone abbreviation
|
|
- `utc_offset`: Offset from UTC (positive means east of Greenwich)
|
|
- `is_dst`: True if currently observing daylight savings
|
|
|
|
|
|
<Tabs
|
|
defaultActiveId="sql"
|
|
groupId="reference/postgres"
|
|
values={[{ label: 'SQL', value: 'sql' }]}>
|
|
|
|
<TabsPanel id="sql" label="sql">
|
|
|
|
```sql
|
|
select name, abbrev, utc_offset, is_dst
|
|
from pg_timezone_names()
|
|
order by name;
|
|
```
|
|
|
|
|
|
</TabsPanel>
|
|
|
|
</Tabs>
|
|
|
|
### Search for a specific timezone
|
|
|
|
Use `ilike` (case insensitive search) to find specific timezones.
|
|
|
|
<Tabs
|
|
defaultActiveId="sql"
|
|
groupId="reference/postgres"
|
|
values={[{ label: 'SQL', value: 'sql' }]}>
|
|
|
|
<TabsPanel id="sql" label="sql">
|
|
|
|
```sql
|
|
select *
|
|
from pg_timezone_names()
|
|
where name ilike '%york%';
|
|
```
|
|
|
|
|
|
</TabsPanel>
|
|
|
|
</Tabs> |