5544992 发表于 2016-12-21 09:59:20

postgresql查询结果中去掉时区和精度

原来一直使用postgresql的函数来拼凑,今天突然发现竟然可以这么简单,直接用timestamp(0)来解决就好了:



[*]ls=> select createtime::timestamp(0) without time zone from users;

[*]   createtime
[*]---------------------
[*] 2015-10-03 01:32:03
[*] 2015-10-03 01:32:03
[*] 2015-10-03 01:32:03
[*](3 行记录)
[*]
[*]ls=> select createtime::timestamp without time zone from users;
[*]         createtime
[*]----------------------------
[*] 2015-10-03 01:32:03.080415
[*] 2015-10-03 01:32:03.080415
[*] 2015-10-03 01:32:03.080415
[*](3 行记录)
页: [1]
查看完整版本: postgresql查询结果中去掉时区和精度