如何获取PostgreSQL支持的时区列表? [英] How to get the list of timezones supported by PostgreSQL?

查看:542
本文介绍了如何获取PostgreSQL支持的时区列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题很不言自明。我在这里找到此文档:

The question is pretty self-explanatory. I found this documentation here:

https://www.postgresql.org/docs/current/view-pg-timezone-names.html

但是,它并没有真正提到如何获取所有支持的时区的列表。我怎样才能做到这一点?

However, it does not really mention how to get a list of all the supported timezones. How can I do this?

推荐答案

您可以尝试从 pg_timezone_names 选择 $ c>,如文档所述:

You may try selecting from the view pg_timezone_names, as the documentation says:


视图pg_timezone_names提供了SET TIMEZONE可以识别的时区名称列表,以及它们的相关缩写,UTC偏移量和夏时制状态。

The view pg_timezone_names provides a list of time zone names that are recognized by SET TIMEZONE, along with their associated abbreviations, UTC offsets, and daylight-savings status.

尝试以下查询:

SELECT
    name,
    abbrev,
    utc_offset,
    is_dst
FROM pg_timezone_names;

这篇关于如何获取PostgreSQL支持的时区列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆