Solved

iCalendar message changing meeting time

Posted on 2011-03-10
1
967 Views
Last Modified: 2012-05-11
Hello,

I am writing an app for work which uses JSP to create iCalendar objects and sends them to given recipients. This will allow us to sync our system proprietary calendar with Outlook. (Just for convenience reasons). I have been able to get it working to some degree so far. But, for some reason, when I change the DTSTART, DTEND, and DTSTAMP properties to be in UTC format (adding capital Z at the end for time zone reference) the meeting message comes up showing the wrong start and end time. ie. If I send a message about a meeting starting at 11:45am and ending at 12:15pm, the meeting confirmation message lists the time as starting at 7:45am and ending at 8:15am. Can someone please tell me why this is happening?

Here is the code for the iCalendar writer:

SimpleDateFormat iCalendarDateFormat = new SimpleDateFormat("yyyyMMdd'T'HHmm'00Z'");

java.util.Date startdate = DATE_PARSER.parse(request.getParameter("start_date"));
            java.util.Date enddate = DATE_PARSER.parse(request.getParameter("end_date"));
            String StartDate = DATEID.format(startdate) + "T" + request.getParameter("start_time") + "00Z";
            String EndDate = DATEID.format(enddate) + "T" + request.getParameter("end_time") + "00Z";

String calendarContent =
                "BEGIN:VCALENDAR\n" +
                "METHOD:REQUEST\n" +
                "PRODID: BCP - Meeting\n" +
                "VERSION:2.0\n" +
            "BEGIN: VTIMEZONE\n" +
            "TZID:US-Eastern\n" +
            "TZNAME:EST\n" +
            "BEGIN:STANDARD\n" +
            "DTSTART:16010101T020000\n" +
            "TZOFFSETFROM:-0400\n" +
            "TZOFFSETTO:-0500\n" +
            "RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11BYDAY=1SU\n" +
            "END:STANDARD\n" +
            "BEGIN:DAYLIGHT\n" +
            "DTSTART:16010101T020000\n" +
            "TZOFFSETFROM:-0500\n" +
            "TZOFFSETTO:-0400\n" +
            "RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU\n" +
            "END:DAYLIGHT\n" +
            "END:TIMEZONE\n" +
                "BEGIN:VEVENT\n" +
                "DTSTAMP:" + iCalendarDateFormat.format(stamp) + "\n" +
                "DTSTART:" + StartDate + "\n" +
                "DTEND:"  + EndDate + "\n" +
                "SUMMARY:" + request.getParameter("subject") + "\n" +
                "UID:324\n" +
                "ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:MAILTO:" + request.getParameter("to") + "\n" +
                "ORGANIZER:" + request.getParameter("from") + "\n" +
                "LOCATION:" + request.getParameter("location") + "\n" +
                "DESCRIPTION:" + request.getParameter("comments") + "\n" +
                "SEQUENCE:0\n" +
                "PRIORITY:5\n" +
                "CLASS:PUBLIC\n" +
                "STATUS:CONFIRMED\n" +
                "TRANSP:OPAQUE\n" +
                "BEGIN:VALARM\n" +
                "ACTION:DISPLAY\n" +
                "DESCRIPTION:REMINDER\n" +
                "TRIGGER;RELATED=START:-PT00H15M00S\n" +
                "END:VALARM\n" +
                "END:VEVENT\n" +
                "END:VCALENDAR";

note:still WIP so some fields not completely realized yet.

Thanks in advance,

-Randal
 
0
Comment
Question by:Brunke76
1 Comment
 
LVL 1

Accepted Solution

by:
Brunke76 earned 0 total points
ID: 35128395
Well no one responded to this question so I am closing it. But I did find a solution to the problem, so I thought that I would add it here for archival reasons.

The problem was in the time zone format that I had been using. The documentation is not particularly clear on this (at least it wasn't to me) but the way the capital "Z" at the end of the UTC format works is that it assumes that the time given is set to GMT. Then the receiving computer translates the time to the proper Time Zone. The reason that it was off by four hours, and not five, was because of some extraneous code that was adding an hour to the input time.

So, to fix the problem, I just recoded the JSP to automatically add the UTC offset to the input time (thereby making it equal to the GMT equivalent) before tacking the "Z" at the end... Problem solved. Now, no matter what time zone the recipient happens to be in, the meeting time will be displayed at the correct time, Yay!

Hope this story helps someone eventually, I hate searching through threads only to find that they were never resolved.

Thanks,

Randal
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now