如何处理CFML中的时区? [英] How to handle timezones in CFML?

查看:191
本文介绍了如何处理CFML中的时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

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

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?

还是你家伙使用任何java方法?

Or do you guys use any java methods?

推荐答案

我在前一段时间研究了这个问题,发现和Coldfusion / Java示例非常有帮助:/www.sustainablegis.com/blog/cfg11n/index.cfm?mode=cat&catid=162AEDB4-20ED-7DEE-2A6CF1B79AC2E03Arel =noreferrer

I was looking into the issue some time ago and found Paul Hasting's blog and Coldfusion/Java examples very helpful:

不要忘记查看他的 TZCFC测试台

如何存储日期可能取决于您的业务逻辑。在一个项目中,我做了我们必须在时区内实施人力资源调度,我们以UTC为单位存储日期/时间,并在数据库中使用datediff来检查冲突。

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.

编辑:

这篇关于如何处理CFML中的时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆