php中的时区转换
我在谷歌日历中的默认时区是(GMT-08:00)太平洋时间。现在我生成一个会议请求并邀请两个人。
1) 一个人的日历中的默认时区是 (GMT+05:30) 太平洋时间,并且他的电子邮件通过 Microsoft Exchange 服务器发送。
2) 其次,我邀请了一个使用默认时区的 Gmail 帐户的人时区为 (GMT+05:30)。
我查看的 ics 文件的 DTSTART 为 DTSTART:20110506T170000Z,它的意思就像
yyyymmdd T hhmmss 所以 gmail 中的时间是正确的。
但是第一个查看微软的人得到 DTSTART:20110506T070000Z 所以这里我的问题是如何转换时区以便两者都相同...
date_default_timezone_set($timezonename[0]->timzone_val);
$meetingstamp = strtotime($meeting_date." ".$timezonename[0]->timzone_val);
$dtstart= gmdate("Ymd\This\Z",$meetingstamp);
$dtend= gmdate("Ymd\This\Z",$meetingstamp+$meeting_duration);
$todaystamp = gmdate("Ymd\This\Z");
这里我的时区是 America/Los_Angeles 那么我应该如何使用哪个函数来获得正确的计时...????
My defaulst timezone in google calendar is (GMT-08:00) Pacific Time. Now i generate a meeting request and invite two persons.
1) one person whose default timezone in his calendar is (GMT+05:30) Pacific Time and his email are coming through microsoft exchange server.
2) second i invite a person on gmail account who is having default timezone as (GMT+05:30).
the ics file which i view has DTSTART as DTSTART:20110506T170000Z it just means like
yyyymmdd T hhmmss so here time comes proper in gmail.
but the first person viewing microsoft gets DTSTART:20110506T070000Z so here my question is how to convert timezone so that both comes the same...
date_default_timezone_set($timezonename[0]->timzone_val);
$meetingstamp = strtotime($meeting_date." ".$timezonename[0]->timzone_val);
$dtstart= gmdate("Ymd\This\Z",$meetingstamp);
$dtend= gmdate("Ymd\This\Z",$meetingstamp+$meeting_duration);
$todaystamp = gmdate("Ymd\This\Z");
here my timzone comes as America/Los_Angeles so how which function shall i use to get proper timings...????
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
顺便说一下,它应该是日期格式字符串中的大写
H
,因为小写h
代表我们的 12-hout-format。EDIT 最后评论
结果
之后这正是您想要获得的值。
It should be an upper-case
H
in the date formatting string by the way, beacuse lower-caseh
represents ours in 12-hout-format.EDIT after last comment
results in
That are exactly the values you'd like to get.