douke6027 2013-09-25 10:43
浏览 33
已采纳

PHP / MySQL - 存储用于跨时区的日期选择报告的日期

currently debating the best way to proceed with regard to storing dates and would appreciate experienced comments - looking for the 'why' rather than the 'how'.

Scenario:

We are developing a system that allows clients (across multiple timezones) to create transactional data. At sign-up the client will have nominated their timezone. A large part of the system revolves around the client running date and time related reports on the transactional data.

We have read numerous questions and comments regarding the best way to store the transactional date field and most say store as UTC and then perform various date and time related functions to work out the time in the various timezones in order to run the selection reports.

Our question is - why go to all the trouble of storing in UTC - what is the advantage of storing the date in UTC. From our point of view we have the client's nominated timezone so if we store the date/time in their correct timezone then it’s a calculation that we run once per transaction - thereafter all their reporting will work without any date transforming calculations.

As most of the questions and comments we have read refer to the 'How' we think there must be something about the 'Why' that we have missed.

So, in summary, before we make our decision have we missed something - is there an absolute 'must store dates as UTC' reason?

Thanks for reading - any comments appreciated.

  • 写回答

3条回答 默认 最新

  • dongtuoleng8624 2013-09-25 10:57
    关注

    No, in my opinion there is no 'must' in this! this is totally a design issue, what you choose to use will determine the way the things will work, in either case, it's just a referencing issue, the people who are suggesting the use of UTC, is because it is the well known and verified reference, and no matter how big your program becomes or where your clients are, the reference is always there, but if you use, another time zone, things will work the same way but the time zone you choose will be the reference, which may cause misunderstanding in some situations, but still, in a controlled environment it's totally the same. I hope I answered your question.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?