脚本宝典收集整理的这篇文章主要介绍了php – 向Google日历添加活动时的时差,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
问题是,当我尝试添加事件时,存在时差问题.
例如,如果我将以下内容添加到日历03/21/2012上午8:00,则在Web上查看的日历条目中的时间将设置为17:30.
这是我的代码:
$gmail = 'mail@gmail.COM'; $gpwd = '1233'; $datetime1 = strtotime('03/21/2012 8:00am'); $date1 = date("Y-m-d",$datetime1); $idg = add_to_calenderNow1($gmail,$gpwd,$id,$date1,$datetime1); function add_to_calenderNow1($gmail,$ticket,$date,$timestamp){ if($gmail){ /* Change the below path wITh correct path class1.PHP and class2.PHP are in the includes directory */ include('includes/class1.PHP'); include('includes/class2.PHP'); $email = $gmail; $password = $gpwd; $altEmail = $gmail; $login = new GoogleClientLOGin($email,$password,GoogleClientLogin::$CALENDAR_SERVICE,APP_NAME); $cal = new GoogleCalendar($login); $cal->altEmail = $altEmail; $content = "Ticket #".$ticket." scheduled Now"; $entryData = $cal->addEvent(array( "title"=> "Ticket #".$ticket." Scehduled An Item","content"=> $content,"where"=> "","startTime"=> $timestamp,"endTime"=> $timestamp )); $id_Now = explode('Feeds/',$entryData['id']); $sec_id = $id_Now[1]; $id_id = explode('/',$sec_id); return $id_id[0]; } }
GoogleClientLogin和GoogleCalendar课程来自此博文:
http://mark.biek.org/blog/2010/07/addingdeleting-events-with-the-google-calendar-api/
有没有人对可能导致这种情况的原因有任何想法?
以上是脚本宝典为你收集整理的php – 向Google日历添加活动时的时差全部内容,希望文章能够帮你解决php – 向Google日历添加活动时的时差所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。