如何管理Web应用程序中的时区? [英] How to manage timezones in a web application?
问题描述
-
存储日期/时间为UTC(不知道Python命令为此)
-
输出日期时,将其包装在帮助函数中,获取当前用户的时区首选项,然后调整偏移量的时间/日期,然后从应用程序中输出。
http://docs.python.org/library/time.html
http://docs.python.org/library/datetime.html
I wan't to manage the different timezones of my users in my web application, but I have no idea where to start. I have to save the local time of each user in my database?, or maybe make the conversion to a UTC time, save it, and then make the conversion again to show it?, or there is another way? For example, if one of my users make an appointment in his local time, I have to convert it to UTC store it in my database, and then when he need it, convert it again to his local time an show it?? By the way, I'm using Django. Thanks.
Store date/time as UTC (Not sure what the Python command for that is)
When outputting dates, wrap them in a helper function that gets the current user's time zone preference, then adjust the time/date for the offset, then output it from the application.
http://docs.python.org/library/time.html
http://docs.python.org/library/datetime.html
这篇关于如何管理Web应用程序中的时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!