?
Solved

iCalendar message changing meeting time

Posted on 2011-03-10
1
Medium Priority
?
996 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Suggested Courses

770 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