[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

iCalendar message changing meeting time

Posted on 2011-03-10
1
Medium Priority
?
1,004 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Mailbox Overload?
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
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…

649 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