增量/减量时间

时间:2017-05-15 06:19:55

标签: database postgresql datetime increment

我需要增加/减少PostgreSQL数据库中的时间。

以下是包含列类型为"时区没有时区"

的表格的输出

如果时间超过24小时,我也需要更改日期。请协助

select start_time from XXXXX;

    "2017-05-15 15:08:54.639"
    "2017-05-10 17:30:25.056"
    "2017-05-10 17:35:35.418"
    "2017-05-11 15:05:40.071"
    "2017-05-11 18:11:51.431"
    "2017-05-18 11:15:00"
    "2017-05-11 15:07:43.534"
    "2017-05-11 15:10:15.808"
    "2017-05-11 15:15:24.847"
    "2017-05-15 17:39:00"

如果我增加1小时,样本输出应该如下

   "2017-05-15 16:08:54.639"
    "2017-05-10 18:30:25.056"
    "2017-05-10 18:35:35.418"
    "2017-05-11 16:05:40.071"
    "2017-05-11 19:11:51.431"
    "2017-05-18 12:15:00"
    "2017-05-11 16:07:43.534"
    "2017-05-11 16:10:15.808"
    "2017-05-11 16:15:24.847"
    "2017-05-15 18:39:00"

1 个答案:

答案 0 :(得分:2)

只需在值中添加interval of 1 hour

select start_time + interval '1' hour
from ...