Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 如何在保留时间戳postgres中的时间的同时只更改日期?_Sql_Postgresql - Fatal编程技术网

Sql 如何在保留时间戳postgres中的时间的同时只更改日期?

Sql 如何在保留时间戳postgres中的时间的同时只更改日期?,sql,postgresql,Sql,Postgresql,我想只更改日期部分,而在postgresql datetime列中保留时间部分不变 2019-09-02 10:00:00 到 2019-10-26 10:00:00您没有指定要使用的逻辑。如果要添加或减去间隔,可以使用: select '2019-09-02 10:00:00'::timestamp + interval '1 month 24 day' 如果要直接指定第二个日期: select '2019-10-26'::timestamp + ('2019-09-02 10:00:00'

我想只更改日期部分,而在postgresql datetime列中保留时间部分不变

2019-09-02 10:00:00


2019-10-26 10:00:00

您没有指定要使用的逻辑。如果要添加或减去间隔,可以使用:

select '2019-09-02 10:00:00'::timestamp + interval '1 month 24 day'
如果要直接指定第二个日期:

select '2019-10-26'::timestamp + ('2019-09-02 10:00:00'::timestamp)::time

添加一个间隔<代码>选择“2019-09-02 10:00:00”::时间戳+54天:::间隔请更具体一点。我想通过不更改时间来更新整列的日期,这就是Jason的表达式将要做的