views:

111

answers:

1

I'm creating an iCal feed using DDay.iCal. It works, but I can't figure out how to set the timezone for the feed. Here's the basic code:

iCalendar iCal = new iCalendar();

// <-- Set the Timezone HERE to PST (Pacific Daylight Time)

Event evt = iCal.Create<Event>();

evt.Start = new iCalDateTime(meeting.MeetDate);
evt.End = evt.Start.AddHours(4); // 4 hour event
evt.Description = "This meeting...";
evt.Summary = "Event Summary";

Any ideas?

+1  A: 

Example6 in the download is setting timezones and whatnot for events. Check that out.

Relevant lines:

            IICalendar iCal = new iCalendar();
        iCal.AddChild(timeZones.GetTimeZone("America/New_York"));
        iCal.AddChild(timeZones.GetTimeZone("America/Denver"));            

        // Set the event to start at 11:00 A.M. New York time on January 2, 2007.
        evt.Start = new iCalDateTime(2007, 1, 2, 11, 0, 0, "America/New_York", iCal);
Nikki9696