如何处理 CFML 中的时区?
如何处理 CFML 中的时区? 到目前为止,我编写的所有应用程序都只使用 CF 服务器和/或 SQL 服务器的默认时区。
你们平时都做什么? 您是否使用 GetTimezineInfo() 和 DateAdd() 将所有日期存储在 GMT 中,并根据登录用户的偏好将所有时间转换为正确的时区?
或者你们使用任何java方法吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我前段时间正在研究这个问题,发现 Paul Hasting 的博客 和 Coldfusion/Java 示例非常有帮助:
不要忘记查看他的 TZCFC 测试台
如何存储日期可能取决于您的业务逻辑。 在我做过的一个项目中,我们必须跨时区实施人力资源调度,我们将日期/时间存储在 UTC 中,并在数据库中使用 datediff 来检查冲突。
编辑:
时区信息
I was looking into the issue some time ago and found Paul Hasting's blog and Coldfusion/Java examples very helpful:
Don't forget to check out his TZCFC test bed
How to store dates will probably depend on your business logic. In a project I did where we had to implement human resource scheduling across timezones we stored dates/times in UTC and used datediff in the database to check for conflicts.
EDIT:
time zone information