{"id":3142,"date":"2012-06-09T16:34:27","date_gmt":"2012-06-09T14:34:27","guid":{"rendered":"http:\/\/www.limilabs.com\/blog\/?p=3142"},"modified":"2025-10-28T23:25:17","modified_gmt":"2025-10-28T21:25:17","slug":"send-icalendar-recurring-meeting-requests-different-timezone","status":"publish","type":"post","link":"https:\/\/www.limilabs.com\/blog\/send-icalendar-recurring-meeting-requests-different-timezone","title":{"rendered":"Send iCalendar recurring meeting requests for a different timezone"},"content":{"rendered":"\n<p>Usually you <a href=\"\/blog\/send-icalendar-meeting-requests-for-different-timezone\">define time of an event in relation to UTC timezone<\/a> or local timezone.<\/p>\n\n\n\n<p>If you need to define event on <strong>9:00 o&#8217;clock in Alaska<\/strong> you simply need to subtract 9 hours from event time to get the event time in UTC (18:00:00 UTC): 18 &#8211; 9 = 9.<\/p>\n\n\n\n<p>It all works great in December (Alaska is UTC-9), but in May, <strong>daylight saving time is in effect<\/strong> in Alaska and Alaska is UTC-8 then. <\/p>\n\n\n\n<p>In May, event is going to be held at <strong>10:00 Alaska time<\/strong> (18 &#8211; 8 = 10). <\/p>\n\n\n\n<p>Which is sadly most likely not what you want.<\/p>\n\n\n\n<p>If you need to define a single instance of the event it is still not a problem: You need to use UTC time for the event, so you simply subtract 9 hours in the winter and 8 hours in the summer. Or rather you convert local Alaska time to UTC once &#8211; when you create the event.<\/p>\n\n\n\n<p>But if the event is <strong>recurring<\/strong>, and should be held always at <strong>9:00 Alaska time<\/strong>, you need to <strong>specify the timezone along with the event<\/strong>.<\/p>\n\n\n\n<p>As the timezones in different parts of world change way to often to reflect these changes in Mail.dll, you&#8217;ll need to specify the timezone, when creating a new event (and include the daylight savings time component).<\/p>\n\n\n\n<p>Here&#8217;s the sample:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/ C#\n\nusing Fluent = Limilabs.Mail.Fluent;\nusing Limilabs.Client.SMTP;\nusing Limilabs.Mail;\nusing Limilabs.Mail.Appointments;\n\nAppointment appointment = new Appointment();\n\n\/\/ Create time zone\nVTimeZone alaska = appointment.AddTimeZone();\nalaska.TimeZoneId = \"America\/Anchorage\";\n\n\/\/ Define standard time offset\nvar standardRecurring = new RecurringRule();\nstandardRecurring.Frequency = Frequency.Yearly;\nstandardRecurring.ByDay.Add(Weekday.FirstSunday);\nstandardRecurring.ByMonths.Add(11);\n\nvar standard = new StandardOffset\n{\n    Name = \"AKST\",\n    Start = new DateTime(1970, 11, 01, 02, 00, 00),\n    OffsetFrom = TimeSpan.FromHours(-8),\n    OffsetTo = TimeSpan.FromHours(-9),\n    RecurringRule = standardRecurring\n};\n\n\/\/ Define daylight time offset component\nvar daylightRecurring = new RecurringRule();\ndaylightRecurring.Frequency = Frequency.Yearly;\ndaylightRecurring.ByDay.Add(new Weekday(2, Weekday.Sunday));\ndaylightRecurring.ByMonths.Add(3);\n\nvar daylight = new DaylightOffset\n{\n    Name = \"AKDT\",\n    Start = new DateTime(1970, 03, 08, 02, 00, 00),\n    OffsetFrom = TimeSpan.FromHours(-9),\n    OffsetTo = TimeSpan.FromHours(-8),\n    RecurringRule = daylightRecurring\n};\n\nalaska.Standard.Add(standard);\nalaska.Daylight.Add(daylight);\n\n\/\/ Define the event\nEvent e = appointment.AddEvent();\ne.Start = new DateTime(2025, 08, 17, 12, 00, 00);\ne.End = new DateTime(2025, 08, 17, 12, 30, 00);\ne.Summary = \"At noon in Alaska\";\ne.InTimeZone(alaska);\n\n\/\/ Make event recurring\nRecurringRule rule = e.AddRecurringRule();\nrule.Interval = 1;\nrule.Until = new DateTime(2029, 12, 1); \/\/ -or- rule.Count = 10;\n\n\/\/ Every week on  Mon, Tue, Wed, Thu Fri:\nrule.Frequency = Frequency.Weekly;\nrule.ByDay.AddRange(new&#x5B;] {\n    Weekday.Monday,\n    Weekday.Tuesday,\n    Weekday.Wednesday,\n    Weekday.Thursday,\n    Weekday.Friday });\n\n\/\/ Set participants\ne.SetOrganizer(new Person(\"Alice\", \"alice@example.org\"));\n\ne.AddParticipant(new Participant(\n    \"Bob\", \"bob@example.org\", ParticipationRole.Required, true));\ne.AddParticipant(new Participant(\n    \"Tom\", \"tom@example.org\", ParticipationRole.Optional, true));\ne.AddParticipant(new Participant(\n     \"Alice\", \"alice@example.org\", ParticipationRole.Required, true));\n\n\/\/ Add alarm\nAlarm alarm = e.AddAlarm();\nalarm.BeforeStart(TimeSpan.FromMinutes(15));\n\nIMail email = Fluent.Mail\n    .Text(\"Status meeting at noon in Alaska.\")\n    .Subject(\"Status meeting\")\n    .From(\"alice@example.org\")\n    .To(\"bob@example.org\")\n    .To(\"tom@example.org\")\n    .AddAppointment(appointment)\n    .Create();\n\nusing (Smtp smtp = new Smtp())\n{\n    smtp.ConnectSSL(\"smtp.example.org\");\n    smtp.UseBestLogin(\"user\", \"password\");\n    smtp.SendMessage(email);\n    smtp.Close();\n}\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: vb; title: ; notranslate\" title=\"\">\n' VB.NET\n\nImports Fluent = Limilabs.Mail.Fluent\nImports Limilabs.Client.SMTP\nImports Limilabs.Mail\nImports Limilabs.Mail.Appointments\n\nDim appointment As New Appointment()\n\n' Create time zone\nDim alaska As VTimeZone = appointment.AddTimeZone()\nalaska.TimeZoneId = \"America\/Anchorage\"\n\n' Define standard time offset\nDim standardRecurring = New RecurringRule()\nstandardRecurring.Frequency = Frequency.Yearly\nstandardRecurring.ByDay.Add(Weekday.FirstSunday)\nstandardRecurring.ByMonths.Add(11)\n\nDim standard = New StandardOffset() With { _\n\t.Name = \"AKST\", _\n\t.Start = New DateTime(1970, 11, 1, 2, 0, 0), _\n\t.OffsetFrom = TimeSpan.FromHours(-8), _\n\t.OffsetTo = TimeSpan.FromHours(-9), _\n\t.RecurringRule = standardRecurring _\n}\n\n' Define daylight time offset component\nDim daylightRecurring = New RecurringRule()\ndaylightRecurring.Frequency = Frequency.Yearly\ndaylightRecurring.ByDay.Add(New Weekday(2, Weekday.Sunday))\ndaylightRecurring.ByMonths.Add(3)\n\nDim daylight = New DaylightOffset() With { _\n\t.Name = \"AKDT\", _\n\t.Start = New DateTime(1970, 3, 8, 2, 0, 0), _\n\t.OffsetFrom = TimeSpan.FromHours(-9), _\n\t.OffsetTo = TimeSpan.FromHours(-8), _\n\t.RecurringRule = daylightRecurring _\n}\n\nalaska.Standard.Add(standard)\nalaska.Daylight.Add(daylight)\n\n' Define the event\nDim e As &#x5B;Event] = appointment.AddEvent()\ne.Start = New DateTime(2024, 8, 17, 12, 0, 0)\ne.&#x5B;End] = New DateTime(2024, 8, 17, 12, 30, 0)\ne.Summary = \"At noon in Alaska\"\ne.InTimeZone(alaska)\n\n' Make event recurring\nDim rule As RecurringRule = e.AddRecurringRule()\nrule.Interval = 1\nrule.Until = New DateTime(2029, 12, 1) ' -or- rule.Count = 10;\n\n' Every week on  Mon, Tue, Wed, Thu Fri:\nrule.Frequency = Frequency.Weekly\nrule.ByDay.AddRange(New () { _\n    Weekday.Monday, _\n    Weekday.Tuesday, _\n    Weekday.Wednesday, _\n    Weekday.Thursday, _\n    Weekday.Friday})\n\n' Set participants\ne.SetOrganizer(New Person(\"Alice\", \"alice@example.org\"))\n\ne.AddParticipant(New Participant( _\n    \"Bob\", \"bob@example.org\", ParticipationRole.Required, True))\ne.AddParticipant(New Participant( _\n    \"Tom\", \"tom@example.org\", ParticipationRole.&#x5B;Optional], True))\ne.AddParticipant(New Participant( _\n    \"Alice\", \"alice@example.org\", ParticipationRole.Required, True))\n\n' Add alarm\nDim alarm As Alarm = e.AddAlarm()\nalarm.BeforeStart(TimeSpan.FromMinutes(15))\n\nDim email As IMail = Fluent.Mail _\n\t.Text(\"Status meeting at noon in Alaska.\") _\n\t.Subject(\"Status meeting\") _\n\t.From(\"alice@example.org\") _\n\t.&#x5B;To](\"bob@example.org\") _\n\t.&#x5B;To](\"tom@example.org\") _\n\t.AddAppointment(appointment) _\n\t.Create()\n\nUsing smtp As New Smtp()\n\tsmtp.ConnectSSL(\"smtp.example.org\")\n\tsmtp.UseBestLogin(\"user\", \"password\")\n\tsmtp.SendMessage(email)\n\tsmtp.Close()\nEnd Using\n\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">Western European Time Zone (WET)<\/h2>\n\n\n\n<p>Western European Time Zone (WET) with its Daylight Saving Time &#8211; Western European Summer Time (WEST) is defined below:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/ Create time zone\nVTimeZone western = appointment.AddTimeZone();\nwestern.TimeZoneId = \"W. Europe Standard Time\";\n\n\/\/ Define standard time offset\nvar standardRecurring = new RecurringRule();\nstandardRecurring.Frequency = Frequency.Yearly;\nstandardRecurring.ByDay.Add(new Weekday(-1, Weekday.Sunday));\nstandardRecurring.ByMonths.Add(10);\n\nvar standard = new StandardOffset\n{\n    Name = \"WET\", \/\/ Western European Time\n    Start = new DateTime(1601,01,01,03,00,00),\n    OffsetFrom = TimeSpan.FromHours(2),\n    OffsetTo = TimeSpan.FromHours(1),\n    RecurringRule = standardRecurring\n};\n\n\/\/ Define daylight time offset\nvar daylightRecurring = new RecurringRule();\ndaylightRecurring.Frequency = Frequency.Yearly;\ndaylightRecurring.ByDay.Add(new Weekday(-1, Weekday.Sunday));\ndaylightRecurring.ByMonths.Add(3);\n\nvar daylight = new DaylightOffset\n{\n    Name = \"WEST\", \/\/ Western European Summer Time\n    Start = new DateTime(1601,01,01,02,00,00),\n    OffsetFrom = TimeSpan.FromHours(1),\n    OffsetTo = TimeSpan.FromHours(2),\n    RecurringRule = daylightRecurring\n};\n\nwestern.Standard.Add(standard);\nwestern.Daylight.Add(daylight);\n\nEvent e = appointment.AddEvent();\ne.Start = new DateTime(2025, 04, 12, 15, 00, 00);\ne.End = new DateTime(2025, 04, 12, 16, 00, 00);\ne.Summary = \"Event summary\";\ne.InTimeZone(western);\n\n<\/pre><\/div>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Usually you define time of an event in relation to UTC timezone or local timezone. If you need to define event on 9:00 o&#8217;clock in Alaska you simply need to subtract 9 hours from event time to get the event time in UTC (18:00:00 UTC): 18 &#8211; 9 = 9. It all works great in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[15,33,26,50,57],"class_list":["post-3142","post","type-post","status-publish","format-standard","hentry","category-mail-dll","tag-c","tag-email-component","tag-icalendar","tag-smtp","tag-vb-net"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/3142"}],"collection":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/comments?post=3142"}],"version-history":[{"count":10,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/3142\/revisions"}],"predecessor-version":[{"id":6680,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/3142\/revisions\/6680"}],"wp:attachment":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/media?parent=3142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/categories?post=3142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/tags?post=3142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}