Getting date with timezone offset

前端 未结 3 1035
情深已故
情深已故 2020-12-15 07:02

I am trying to extract the date from a query in postgres. The timestamp is stored as UTC, so if I have 1/1/2014 02:00:00, I want the date in pacific time, to be 12/31/2013,

3条回答
  •  感情败类
    2020-12-15 07:28

    If it is timestamp without time zone you need first to tell it to use the UTC time zone and then convert to another time zone:

    SELECT '1-1-2014 02:00:00'::timestamp at time zone 'UTC' at time zone 'America/Los_Angeles';
          timezone       
    ---------------------
     2013-12-31 18:00:00
    

提交回复
热议问题