2017-02-07 48 views
0

我在我的数据库中有该时区America/Sao_Paulo时区与UTC相关的时区

例子:

2017-02-07 10:06:32.157564-02 

ts = db.Column(db.DateTime(timezone=True), index=True, server_default=func.now()) 

我的问题是,这是否意味着10:06:32已经有超过UTC2小时少?所以-2只是提供信息,这是正确的时间。

或者这意味着我们需要从10:06:32减去两小时(-2)以获得America/Sao_Paulo的时区的正确小时数?

+1

@VaoTsun您的评论是混乱的。 –

+0

对不起,感到困惑。我用例子发布了答案。希望这将是明确的 –

+1

@VaoTsun你的意思是*添加*。该值是当地时间。一个反转标志以回到UTC。 –

回答

0

我在GMT + 2个大气压,所以你的实体模型TZ,我将它设置为你的,然后选择您的时间ATM和时间UTC同一时刻:

t=# set timezone TO 'America/Sao_Paulo'; 
SET 
Time: 0.222 ms 
t=# select now() sao_paulo, now() at time zone 'UTC' utc; 
      sao_paulo   |   utc 
-------------------------------+---------------------------- 
2017-02-07 13:54:35.112992-02 | 2017-02-07 15:54:35.112992 
(1 row) 

Time: 0.163 ms