When I execute the following query, It updates the date field with time zone
update person set hiredate='2018-06-18 23:59:59-04:00' where id=5684
When I query the same as:
select * from person where id=5684
I get following value for hiredate: 2018-06-19 09:29:59
(in My timezone +5:30)
But I want to execute a query as
update person set hiredate=now()::date + time '23:59:59-04:00' where id=5684
and run the select query, I get the hiredate as: 2018-06-18 23:59:59
Please help me how I can
time
is short for time without time zone
. Try
UPDATE person
SET hiredate = now()::date + time with time zone '23:59:59-04:00'
WHERE id = 5684;
I think this is what you want is
update person set hiredate= timestamp with
time zone now()::date + time '23:59:59-04:00'
where id=5684;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.