简体   繁体   English

php的ical事件,始于08:00,无论参数如何

[英]ical event from php starting at 08:00 regardless of argument

I am using php to send an ICS calendar invite using this great function: 我正在使用php使用此强大功能发送ICS日历邀请:

    function sendIcalEmail($firstname,$lastname,$email,$meeting_date,$meeting_name,$meeting_duration,$address,$details) {

        $from_name = "Jason";
        $from_address = "abc@email.com";
        $subject = "Showing"; //Doubles as email subject and meeting subject in calendar
        $meeting_description = $details;
        $meeting_location = $address; //Where will your meeting take place
      $message='';

        //Convert MYSQL datetime and construct iCal start, end and issue dates
        $meetingstamp = STRTOTIME($meeting_date . " UTC");
        $dtstart= GMDATE("Ymd\THis\Z",$meetingstamp);
        $dtend= GMDATE("Ymd\THis\Z",$meetingstamp+$meeting_duration);
        $todaystamp = GMDATE("Ymd\THis\Z");

      echo 'start:'.$dtstart.'<br><br>';
      echo 'end:'.$dtend.'<br><br>';

        //Create unique identifier
        $cal_uid = DATE('Ymd').'T'.DATE('His')."-".RAND()."@mydomain.com";

        //Create Mime Boundry
        $mime_boundary = "----Meeting Booking----".MD5(TIME());

        //Create Email Headers
        $headers = "From: ".$from_name." <".$from_address.">\n";
        $headers .= "Reply-To: ".$from_name." <".$from_address.">\n";

        $headers .= "MIME-Version: 1.0\n";
        $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
        $headers .= "Content-class: urn:content-classes:calendarmessage\n";

        //Create Email Body (HTML)
        $message .= "--$mime_boundary\n";
        $message .= "Content-Type: text/html; charset=UTF-8\n";
        $message .= "Content-Transfer-Encoding: 8bit\n\n";

        $message .= "<html>\n";
        $message .= "<body>\n";
        //$message .= '<p>Dear '.$firstname.' '.$lastname.',</p>';
        //$message .= '<p>Here is my HTML Email / Used for Meeting Description</p>';
        $message .= "</body>\n";
        $message .= "</html>\n";
        $message .= "--$mime_boundary\n";

        //Create ICAL Content (Google rfc 2445 for details and examples of usage)
        $ical =    'BEGIN:VCALENDAR
    PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
    VERSION:2.0
    METHOD:PUBLISH
    BEGIN:VEVENT
    ORGANIZER:MAILTO:'.$from_address.'
    DTSTART:'.$dtstart.'
    DTEND:'.$dtend.'
    LOCATION:'.$meeting_location.'
    TRANSP:OPAQUE
    SEQUENCE:0
    UID:'.$cal_uid.'
    DTSTAMP:'.$todaystamp.'
    DESCRIPTION:'.$meeting_description.'
    SUMMARY:'.$subject.'
    PRIORITY:5
    CLASS:PUBLIC
    END:VEVENT
    END:VCALENDAR';

        $message .= 'Content-Type: text/calendar;name="meeting.ics";method=REQUEST\n';
        $message .= "Content-Transfer-Encoding: 8bit\n\n";
        $message .= $ical;

        //SEND MAIL
        $mail_sent = @MAIL( $email, $subject, $message, $headers );

        IF($mail_sent)     {
            RETURN TRUE;
        } ELSE {
            RETURN FALSE;
        }

    }

On my phone I see the following as the date/time: 在手机上,我看到以下内容作为日期/时间:

Thursday Oct 9, 2014 2014年10月9日星期四

from 08:00 to 09:00 从08:00到09:00

from 12:00 to 13:00 (GMT) 从12:00到13:00(GMT)

where my to and from arguments are the following: 我的to和from参数如下:

   start:20141009T120000Z

   end:20141009T130000Z

So to me the 08:00 and 09:00 are unexpected. 所以对我来说08:00和09:00是意外的。 But maybe I am missing something. 但是也许我错过了一些东西。

What is your timezone? 您的时区是什么? Your program, probably, shows the original time in UTC/GMT (letter Z - Zulu in timestamp) and adds time in your timezone. 您的程序可能以UTC / GMT显示原始时间(时间戳中为字母Z-Zulu),并在您的时区中添加时间。 12:00 - 13:00 UTC is the same as 8:00 - 9:00 am ET with daylight. 12:00-13:00 UTC与美国东部时间上午8:00-9:00相同,并带有日光。 Setup the correct timezone in your start and end times. 在开始时间和结束时间中设置正确的时区。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM