Reputation: 623
I need to increment/decrement the timings in PostgreSQL database.
Below is the output for the table containing the column type as "timestamp without time zone"
I need to change the date as well if only time goes above 24 hours. Please assist
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"
If i increment 1 hour, the sample output should be as below
"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"
Upvotes: 0
Views: 99
Reputation:
Just add an interval of 1 hour to the value:
select start_time + interval '1' hour
from ...
Upvotes: 2