首页 > 解决方案 > 如何在 vcalendar 中处理日光和标准时间之间的切换?

问题描述

生成的代码仅适用于当前时区(日光或标准时间)。当我将会议 Outlook 从标准时间发送到夏令时(反之亦然)时,Outlook 会更正会议并将其向前移动 1 小时。

Outlook 将其更正如下:此会议是根据您当前的时区自定义的。最初是在这个时区创建的:欧洲/布拉格。

我发送会议 - 6.5.2020:8-9am,但在 Outlook 中是 6.5.2020:9-10am

Outlook 或我的代码有问题吗?塔克你的任何帮助...

这是 php (7) 中的脚本,用于从特定的 xml 源收集事物数据。我需要将它们发送到 Outlook 日历中。我们正在使用 Outlook 2016 和 365。

    function setICalendar(){
  $this->strICalendarClass="\nBEGIN:VCALENDAR\nMETHOD:REQUEST";
  $this->strICalendarClass.="\nBEGIN:VTIMEZONE\nTZID:Europe/Prague";
  $this->strICalendarClass.="\nX-LIC-LOCATION:Europe/Prague";
  $this->strICalendarClass.="\nBEGIN:STANDARD";
  $this->strICalendarClass.="\nDTSTART:19411001T000000";
  $this->strICalendarClass.="\nTZOFFSETFROM:0000\nTZOFFSETTO:0000\nTZNAME:Standard Time";
  $this->strICalendarClass.="\nRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10";
  $this->strICalendarClass.="\nCET";
  $this->strICalendarClass.="\nEND:STANDARD";
  $this->strICalendarClass.="\nBEGIN:DAYLIGHT";
  $this->strICalendarClass.="\nDTSTART:19860504T000000";
  $this->strICalendarClass.="\nTZOFFSETFROM:-0200\nTZOFFSETTO:-0100\nTZNAME:Daylight Savings Time";
  $this->strICalendarClass.="\nRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3";
  $this->strICalendarClass.="\nCEST";
  $this->strICalendarClass.="\nEND:DAYLIGHT\nEND:VTIMEZONE";
  $this->strVEvent="\nBEGIN:VEVENT";

nBEGIN:VCALENDAR
METHOD:REQUEST;
BEGIN:VTIMEZONE
TZID:Europe/Prague;
X-LIC-LOCATION:Europe/Prague;
BEGIN:STANDARD";
DTSTART:19411001T000000;
TZOFFSETFROM:0000
TZOFFSETTO:0000
TZNAME:Standard Time;
RULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10;
CET;
END:STANDARD;
BEGIN:DAYLIGHT;
DTSTART:19860504T000000;
TZOFFSETFROM:-0200
TZOFFSETTO:-0100
TZNAME:Daylight Savings Time;
RULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3;
CEST;
END:DAYLIGHT;
END:VTIMEZONE;

我希望在开始和展望中同时出现。

标签: phpoutlookvcalendar

解决方案


我修理它,像这样,一切正常。

$this->strICalendarClass="\nBEGIN:VCALENDAR\nMETHOD:REQUEST";
  $this->strICalendarClass.="\nBEGIN:VTIMEZONE\nTZID:Europe/Prague";
  $this->strICalendarClass.="X-LIC-LOCATION:Europe/Prague";
  $this->strICalendarClass.="\nBEGIN:STANDARD";
  $this->strICalendarClass.="\nDTSTART:19411001T000000";
  $this->strICalendarClass.="\nTZOFFSETFROM:-0100\nTZOFFSETTO:0000\nTZNAME:Standard Time";
  $this->strICalendarClass.="\nRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10";
  $this->strICalendarClass.="\nCET";
  $this->strICalendarClass.="\nEND:STANDARD";
  $this->strICalendarClass.="\nBEGIN:DAYLIGHT";
  $this->strICalendarClass.="\nDTSTART:20140330T030000";
  $this->strICalendarClass.="\nTZOFFSETFROM:0000\nTZOFFSETTO:+0100\nTZNAME:Daylight Savings Time";
  $this->strICalendarClass.="\nRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3";
  $this->strICalendarClass.="\nCEST";
  $this->strICalendarClass.="\nEND:DAYLIGHT\nEND:VTIMEZONE";

推荐阅读