V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
gotounix
V2EX  ›  问与答

Python Web 开发中的 datetime 时区问题

  •  
  •   gotounix · Jan 19, 2017 · 1151 views
    This topic created in 3398 days ago, the information mentioned may be changed or developed.
    情况:
    使用 SQLAlchemy ,数据库中存的都是 UTC 时间。

    问题:
    比如:统计 2016 年中各个月的数据量,统计的是 2015-12-31 16:00:00 至 2016-12-31 16:00:00 数据,在使用 extract 出 year 和 month 进行 group by 的时候,就会出现 2015 年 12 月~2016 年 12 月,其实应该是 2016 年 1 月~2016 年 12 月。
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1035 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 18:29 · PVG 02:29 · LAX 11:29 · JFK 14:29
    ♥ Do have faith in what you're doing.