Skip to content

Instantly share code, notes, and snippets.

@Hazem-Ben-Khalfallah
Last active July 14, 2020 09:05
Show Gist options
  • Save Hazem-Ben-Khalfallah/5782085 to your computer and use it in GitHub Desktop.
Save Hazem-Ben-Khalfallah/5782085 to your computer and use it in GitHub Desktop.
[Timezone in postgresql] get and set timezone in #postgresql #sql
-- timezone abrev list
select * from pg_timezone_names ;
-- set timezone TO 'pg_timezone_names.name'
set timezone TO 'posix/Africa/Tunis'; --(GMT+01)
set timezone TO 'GMT'; --(UTC/GMT)
-- read current timezone:
SELECT current_setting('TIMEZONE')
--reset timezone for database
alter database DATABASE_NAME set timezone TO 'posix/Africa/Tunis'; --(GMT+01)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment