这个问题非常明显。我正在寻找一个等同于 SQLite日期时间函数的PostgreSQL。

有帮助吗?

解决方案 3

好的,谢谢你的回答,他们帮我指明了正确的方向。我真正想要的是 to_timestamp

其他提示

postgres=# select to_char(now(),'YYYY-mm-dd HH:MM:ss');
       to_char
---------------------
 2008-09-24 02:09:20
(1 row)

postgres=# select to_char(now(),'YYYY-mm-dd HH24:MM:ss');
       to_char
---------------------
 2008-09-24 14:09:20
(1 row)

我认为这就是你在寻找的东西:

时间戳[(p)] [没有时区] 要么 带时区的时间戳[(p)]

否则看看@ http://www.postgresql.org/docs/8.1/interactive/数据类型 - datetime.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top