Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

hi i am generating even from php using ics vacalendar , but when event generate in gamil it change the time for correcting time i have added +0500 as i am in pakistan then it shows correct time what i want i dnt want to use any time zone i want to create event in gmail at that time which i am posting in DTSTART and DTEND without anytimezone

here is my code

 $ical = 'BEGIN:VCALENDAR' . "
" .
        'PRODID:-//Microsoft Corporation//Outlook 16.0 MIMEDIR//EN' . "
" .
        'VERSION:2.0' . "
" .
        'METHOD:REQUEST' . "
" .
        'BEGIN:VTIMEZONE' . "
" .
        'TZID:Eastern Time' . "
" .
        'BEGIN:STANDARD' . "
" .
        'DTSTART:20091101T020000' . "
" .
        'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11' . "
" .
        'TZOFFSETFROM:+0500' . "
" .
        'TZOFFSETTO:+0500' . "
" .
        'TZNAME:UTC' . "
" .
        'END:STANDARD' . "
" .
        'BEGIN:DAYLIGHT' . "
" .
        'DTSTART:20090301T020000' . "
" .
        'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3' . "
" .
        'TZOFFSETFROM:+0500' . "
" .
        'TZOFFSETTO:+0500' . "
" .
        'TZNAME:TZID' . "
" .
        'END:DAYLIGHT' . "
" .
        'END:VTIMEZONE' . "
" .
        'BEGIN:VEVENT' . "
" .
        'ORGANIZER;CN="'.$from_name.'":MAILTO:'.$from_address. "
" .
        'LAST-MODIFIED:' . date("YmdTGis") . "
" .
        'UID:'.date("YmdTGis", strtotime($startTime)).rand()."@".$domain."
" .
        'DTSTAMP:'.date("YmdTGis"). "
" .
        'DTSTART;TZID=UTC:'.date("YmdTHis", strtotime($startTime)). "
" .
        'DTEND;TZID=UTC:'.date("YmdTHis", strtotime($endTime)). "
" .
        'TRANSP:OPAQUE'. "
" .
        'SEQUENCE:1'. "
" .
        'SUMMARY:' . $subject . "
" .
        'LOCATION:' . $location . "
" .
        'CLASS:PUBLIC'. "
" .
        'PRIORITY:5'. "
" .
        'BEGIN:VALARM' . "
" .
        'TRIGGER:-PT15M' . "
" .
        'ACTION:DISPLAY' . "
" .
        'DESCRIPTION:Reminder' . "
" .
        'END:VALARM' . "
" .
        'END:VEVENT'. "
" .
        'END:VCALENDAR'. "
";
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
254 views
Welcome To Ask or Share your Answers For Others

1 Answer

If you don't want to post a timezone, you should know this is only meaningful for some 'events'eg: A reminder to take pills at 10am whichever timezone you are in. That is the only date-time in the ics specifocation for which there is no timezone. It is called 'Local time'. Otherwise you either need to have times in either UTC timezone OR in 'your' timezone with a TZID for your timezone.

The specification says one can post dates 3 different ways:

FORM #1: DATE WITH LOCAL TIME: eg: 19980118T230000 will be 11 pm in any and all timezones, like a morning wakeup alarm

FORM #2: DATE WITH UTC TIME (the Z at the back) eg: 19980119T070000Z

FORM #3: DATE WITH LOCAL TIME AND TIME ZONE REFERENCE eg: TZID=America/New_York:19980119T020000

In forms 2 and 3, the receiving application will adjust the time from UTC or the timezone given to the timezone of the viewer. Form 1 will always be displayed at that time for every zone, so will be different actual time around the world.

See the RFC5545 specification for more details https://www.rfc-editor.org/rfc/rfc5545#section-3.3.5


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...