如何处理Azure中的UTC时间 [英] How to handle Azure's UTC Time

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

问题描述

所以我的Azure存储中的DateTime UTC。
什么是我的系统需要有发言权美国东部时间时间戳来处理它的最佳方法?
不要存放在UTC,但手柄只是在格式化他们显示时间戳?
难道我的格式/将它们存储在数据库前偏移时间戳?
什么是解决这一问题的最佳做法是什么?

So I Azure stores DateTime in UTC. What is the best way to handle it if my system need to have timestamps in say US Eastern Time? Do store in utc, but handle just displaying timestamps by formating them? Do I format/offset timestamps before storing them in DB? What is the best practice for solving this issue?

感谢

推荐答案

我一直主张在UTC时间存储,因为它是在其中您可以计算任何其他时间断区的标准时间。这意味着如果你有其中任何一个都可以从任何地点连接到服务,很容易要么检测时区在当前用户基于他们的系统上,或者将它们保存,他们将preFER看到时区时间从应用程序开始出现问题。

I always advocate for storing in UTC time as it is the standard time in which you can calculate any other times zone off of. This means if you have a service in which any one can connect to from any location, it is easier to either detect the timezone the user in currently in based on their system, or have them save the timezone they would prefer to see the time set in from your application.

<一个href=\"http://stackoverflow.com/questions/2532729/daylight-saving-time-and-time-zone-best-practices\">this螺纹有一个非常大的讨论,其篇幅谈论它,你可能有兴趣阅读,以帮助使你的决定。如果您决定来存储UTC与转换的时候,这里是一个文章,解释如何从UTC转换为本地时间在C#

this thread had a very large discussion which talks about it at length, which you might be interested in reading to help make your decision. If you decide to store UTC and convert the time, here is a post explaining How to convert from UTC to Local Time in C#

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

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