本文介绍了关于GMT和UTC的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 你好, 我需要一个时区来存储时间戳,这与日光无关 节省。从我读过的所有内容来看,我似乎都想要GMT或UTC。 唯一的问题是我无法从我读过的任何文档中找到答案 如果有任何差异(实际上,不是科学地和 考虑到地球的轨道等)。 我可以设置我的服务器时区到GMT,但如果我想要UTC,我将不得不使用putenv(''TZ = UTC'')。有人可以确认他们实际上是否相同或者如果一个更好,如果我说的是正确的话 既不受夏令时的影响?最后,如果我将我的服务器设置为 格林威治标准时间(或者就此而言的UTC),我是否也在说那个 情况gmmktime()和gmdate()是否与mktime()和date()完全相同? 非常感谢您的帮助。 解决方案 Marcus写道: 你好, 我需要一个时区来存储时间戳,这与日光无关保存。从我读过的所有内容来看,我似乎都想要GMT或UTC。 唯一的问题是我无法从我读过的任何文档中找到答案 如果有任何差异(实际上,不是科学地和 考虑到地球的轨道等)。 我可以设置我的服务器时区到GMT,但如果我想要UTC,我将不得不使用putenv(''TZ = UTC'')。有人可以确认他们实际上是否相同或者如果一个更好,如果我说的是正确的话 既不受夏令时的影响?最后,如果我将我的服务器设置为 格林威治标准时间(或者就此而言的UTC),我是否也在说那个 情况gmmktime()和gmdate()是否与mktime()和date()完全相同? 非常感谢您的帮助。 我应该详细说明我的第一点,并另外询问是否打电话给: mktime(12,0,0例如,将始终以GMT 或UTC时区返回完全相同的时间戳,反之亦然,即1时间戳导致确切的 相同的12:00:00读数通过date()无论是GMT还是UTC。谢谢。 date()返回服务器时间。 gmdate返回GMT(UTC)时间。 我数据库中的所有日期都存储为GMT / UTC,我在屏幕上显示用户本地 时间。 Marcus写道: Marcus写道: > ;您好, 我需要一个时区来存储时间戳,这与夏令时无关。从我读过的所有内容来看,我似乎都想要GMT或UTC。唯一的问题是,如果存在任何差异(实际上说话,不科学,并考虑到地球的轨道),我无法从任何文件中找到答案。 /> 我可以将我的服务器时区设置为GMT,但如果我想要UTC,我将不得不使用putenv(''TZ = UTC'')。有人可以确认他们是否相同或者是否更好,如果我说明既不受夏令时的影响也是正确的?最后,如果我将我的服务器设置为GMT(或UTC),我也是正确的说,在那个情况下gmmktime()和gmdate()与mktime()完全相同和日期()?非常感谢您的帮助。 我应该详细说明我的第一点,并另外询问是否打电话给: mktime(12,0,0例如,将始终以GMT 或UTC时区返回完全相同的时间戳,反之亦然,即1时间戳导致确切的 相同的12:00:00读数通过date()无论是GMT还是UTC。谢谢。 Snef写道: date()返回服务器时间。 gmdate返回GMT(UTC)时间。 我数据库中的所有日期都存储为GMT / UTC,我在屏幕上显示 用户当地时间。 br /> 感谢您的回复。在我最初的帖子中,我说我计划将服务器时间设置为GMT,因此在这种情况下date()和gmdate() 会是相同的,是的? 此外,根据您所说的,这是否意味着就时间戳而言,GMT和UTC之间没有区别??谢谢。 Hello,I need a timezone to store timestamps in that is independent of daylightsaving. From everything I''ve read, it seems I want either GMT or UTC.The only problem is I can''t figure out from any documentation I''ve readif there is any difference (practically speaking, not scientifically andtaking into account the earth''s orbit etc).I can set my server timezone to GMT, but if I want UTC I will have touse putenv(''TZ=UTC''). Could someone please confirm if they are in factthe same or if one is better, and if I am correct in stating thatneither is affected by daylight saving? Lastly, if I set my server toGMT (or UTC for that matter), am I also correct in saying that in thatcase gmmktime() and gmdate() are the exact same as mktime() and date()?Thank you very much in advance for your help. 解决方案 Marcus wrote:Hello,I need a timezone to store timestamps in that is independent of daylightsaving. From everything I''ve read, it seems I want either GMT or UTC.The only problem is I can''t figure out from any documentation I''ve readif there is any difference (practically speaking, not scientifically andtaking into account the earth''s orbit etc).I can set my server timezone to GMT, but if I want UTC I will have touse putenv(''TZ=UTC''). Could someone please confirm if they are in factthe same or if one is better, and if I am correct in stating thatneither is affected by daylight saving? Lastly, if I set my server toGMT (or UTC for that matter), am I also correct in saying that in thatcase gmmktime() and gmdate() are the exact same as mktime() and date()? Thank you very much in advance for your help.I should elaborate on my first point and ask additionally if a call to:mktime(12, 0, 0, 5, 10, 2007);for example, will always return the exact same timestamp in either GMTor UTC timezone and vice versa, i.e. 1 timestamp resulting in the exactsame 12:00:00 readout via date() whether GMT or UTC. Thanks.date() returns server time. gmdate returns GMT (UTC) time.All the dates in my database are stored as GMT/UTC and I display the users localtime onscreen.Marcus wrote:Marcus wrote:>Hello,I need a timezone to store timestamps in that is independent ofdaylight saving. From everything I''ve read, it seems I want eitherGMT or UTC. The only problem is I can''t figure out from anydocumentation I''ve read if there is any difference (practicallyspeaking, not scientifically and taking into account the earth''s orbitetc).I can set my server timezone to GMT, but if I want UTC I will have touse putenv(''TZ=UTC''). Could someone please confirm if they are infact the same or if one is better, and if I am correct in stating thatneither is affected by daylight saving? Lastly, if I set my server toGMT (or UTC for that matter), am I also correct in saying that in thatcase gmmktime() and gmdate() are the exact same as mktime() anddate()? Thank you very much in advance for your help.I should elaborate on my first point and ask additionally if a call to:mktime(12, 0, 0, 5, 10, 2007);for example, will always return the exact same timestamp in either GMTor UTC timezone and vice versa, i.e. 1 timestamp resulting in the exactsame 12:00:00 readout via date() whether GMT or UTC. Thanks.Snef wrote:date() returns server time. gmdate returns GMT (UTC) time.All the dates in my database are stored as GMT/UTC and I display theusers local time onscreen.Thanks for the reply. In my initial post I said I was planning onsetting the server time to GMT, so in that case date() and gmdate()would be the same, yes?Also, from what you are saying, does that mean there is no differencebetween GMT and UTC as far as timestamps are concerned? Thanks. 这篇关于关于GMT和UTC的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-26 12:17