Solved

iCalendar message changing meeting time

Posted on 2011-03-10
1
975 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
Many people use more than one email account and so it becomes difficult for them to manage them when they use separate accounts,  so, in this article, I have shared an easy way to add Other Mail Accounts in your Google Inbox. It helps to combine all…
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…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

808 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