Reputation: 243
I have a table with two columns each of type timestamp with time zone. I want to insert data a interval of one hour(from 4 to 5) for current date. Timezone is GMT Example - start_date and end_date of type timestamp with time zone.
Today's date is 2020-06-01
I want 2020-06-01T04:00:00Z in start_date and 2020-06-01T05:00:00Z in end_date.
insert into table (start_date,end_date) values (???)
I am trying something like '<<today>>'::date + 'T04:00:00Z'
but it gives me error.
Upvotes: 0
Views: 2212
Reputation: 10163
According PostgreSQL documnetation + interval
can solve this problem like:
INSERT INTO `table` (`start_date`, `end_date`)
VALUES (
'<<today>>'::date + interval '4 hour',
'<<today>>'::date + interval '5 hour'
);
Upvotes: 1