Skip to main content
 首页 » 编程设计

python之在 Tornado 中设置时区

2025年05月04日11cloudgamer

人们如何处理 Tornado 中的时区,以便用户看到相对于他们的时区格式化的时间?我知道默认为 GMT 的 locale.format_date,但如何根据用户设置正确的时区?

请您参考如下方法:

您必须使用 JavaScript 将 JavaScript 的时区偏移量设置到 cookie 中

var userDate = new Date(); 
var tzOffset = userDate.getTimezoneOffset(); 
// Now set the cookie