python - Flask 项目中,怎样设置时区?
黄舟
黄舟 2017-04-17 13:43:40
0
3
1117

django 中,设置好时区 Time Zone,就不用再去操心时间的转换问题了。
但是在 Flask 中,就没有这种配置了。
So,怎样解决?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(3)
黄舟

Does flask have it? Isn't it set in Linux?

Peter_Zhu

My general approach is that when developing APIs, the time zone is not set in the database or view, or in other words, it is set to the 无时区 state by default. That is a utc time.

The timing is then handled by the API caller. You can pass in the time zone parameter, or directly get the utc time and process it. Compared with the situation xxx hours ago, UTC is OK.

巴扎黑

The background time is unified using UTC time, and Monent.js is used when displaying on the client

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!