我试图理解PostgreSQL保存timestamp
数据类型的原始方式。根据我使用的客户机,我得到两个不同的结果:
1。psql
# SELECT date_incorporated FROM client;
date_incorporated
------------------------
2017-06-14 19:42:15-04
2。recordspython模块
^{pr2}$由于psql
接口和records模块都应该将原始数据返回给我,我不明白为什么这两个模块都返回了它们存储的时间戳的不同格式。在
到目前为止,我看到的两个不同之处是T
在records版本中位于日期和时间之间的中间,以及它在字符串末尾显示时区的不同方式
有人在改变吗?哪一个显示的是真实的数据?在
https://www.postgresql.org/docs/current/static/datatype-datetime.html
https://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT
例如:
所以时间是节省的,而不是返回的方式。至少没有。您可以在一定程度上控制它如何返回给您的客户机。
psql
不处理时间。但是python
确实如此。我相信不是records
而是python
本身https://en.wikipedia.org/wiki/ISO_8601
而且
T
肯定不是postgres自己添加的(除非您故意用to_char
格式化日期)相关问题 更多 >
编程相关推荐