如何处理 CFML 中的时区?

发布于 2024-07-18 16:28:13 字数 194 浏览 3 评论 0 原文

如何处理 CFML 中的时区? 到目前为止,我编写的所有应用程序都只使用 CF 服务器和/或 SQL 服务器的默认时区。

你们平时都做什么? 您是否使用 GetTimezineInfo() 和 DateAdd() 将所有日期存储在 GMT 中,并根据登录用户的偏好将所有时间转换为正确的时区?

或者你们使用任何java方法吗?

How to handle timezones in CFML? So far all apps I've wrote just use the default timezone of the CF server and/or SQL server.

What do you guys usually do? Do you store all dates in GMT with GetTimezineInfo() and then DateAdd(), and translate all time to the correct timezone based on logged in user's preference?

Or do you guys use any java methods?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

铜锣湾横着走 2024-07-25 16:28:13

我前段时间正在研究这个问题,发现 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:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文