Solved

iCalendar message changing meeting time

Posted on 2011-03-10
1
977 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
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…
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 …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

735 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