hello my friends
I have write a application that send appointment to outlook with asp.net and c#.i need to send date in shamsi date format,and my time zone set to tehran GMT(+03:30).but timezone and date dose not work correctly.for example when i send an appointment with start time=06.30 and end time=12.00 ,the client receive start time=12.30 and end time=1.30, and date dose not receive in shamsi date format!!!
my code is:

sbICSFile.AppendLine("BEGIN:VCALENDAR");
            sbICSFile.AppendLine("VERSION:2.0");
            sbICSFile.AppendLine("PRODID: - //Tehran/");
            sbICSFile.AppendLine("BEGIN:VEVENT");
            sbICSFile.AppendLine("BEGIN:VTIMEZONE");
            sbICSFile.AppendLine("TZID:Tehran/IR");
            sbICSFile.AppendLine("BEGIN: STANDARD");
            sbICSFile.AppendLine("DTSTART:20090923T020000");          
            sbICSFile.AppendLine("TZOFFSETFROM:+0330");
            sbICSFile.AppendLine("TZOFFSETTO:+0430");
            sbICSFile.AppendLine("TZNAME:EST");
            sbICSFile.AppendLine("END: STANDARD");
            sbICSFile.AppendLine("BEGIN: DAYLIGHT");
            sbICSFile.AppendLine("DTSTART:20090321T020000");        
            sbICSFile.AppendLine("TZOFFSETFROM:+0430");
            sbICSFile.AppendLine("TZOFFSETTO:+0330");
            sbICSFile.AppendLine("TZNAME:Tehran");
            sbICSFile.AppendLine("END: DAYLIGHT");
            sbICSFile.AppendLine("END:VTIMEZONE");

            DateTime d = calStartDate.SelectedDate;
            SHAMSIDATE sd = Jalali.MiladiToShamsi(d.Month, d.Day, d.Year);

            sbICSFile.Append("DTSTART;TZID=" + "Tehran/IR" + ":");
            sbICSFile.Append(sd.iYear);
            sbICSFile.Append(
                FormatDateTimeValue(sd.iMonth));
            sbICSFile.Append(
                FormatDateTimeValue(sd.iDay) + "T");
            sbICSFile.AppendLine(ddlStartTime.SelectedValue);

            sbICSFile.Append("DTEND;TZID=" + ":");
            sbICSFile.Append(sd.iYear);
            sbICSFile.Append(
                FormatDateTimeValue(sd.iMonth));
            sbICSFile.Append(
                FormatDateTimeValue(sd.iDay) + "T");
            sbICSFile.AppendLine(ddlEndTime.SelectedValue);

please help me to solve this problems.please.
thanks.

Dani AI

Generated

Short diagnosis: two separate issues are causing the wrong times and the missing Shamsi date. 1) ICS (iCalendar) requires Gregorian (Miladi) date-time values — you cannot put a Shamsi/Jalali year into DTSTART/DTEND. 2) Outlook will silently rebase times if the timezone data or datetime formatting is malformed (wrong VTIMEZONE tokens, missing TZID on DTEND, or time values containing colons).

Fix checklist (practical, in order):

  • Convert the Shamsi/Jalali selection back to a Gregorian DateTime and use that for the ICS fields. Keep the Shamsi text only in the event DESCRIPTION/SUMMARY if you want recipients to see the Persian date.
  • Format datetimes per RFC5545: YYYYMMDDTHHMMSS (no colons). Example forms are either a UTC instant (…T123000Z) or a local time with a valid TZID. A simple, robust approach is to convert to UTC server-side and emit UTC datetimes (avoids building a complex VTIMEZONE):
DateTime local = /* your Gregorian date + time */;
DateTime utc = TimeZoneInfo.ConvertTimeToUtc(local, TimeZoneInfo.Local); // or FindSystemTimeZoneById(...)
string dtstart = utc.ToString("yyyyMMdd'T'HHmmss'Z'");
sbICSFile.AppendLine("DTSTART:" + dtstart);
  • If you keep TZID/VTIMEZONE, make that block correct and consistent: use BEGIN:STANDARD / BEGIN:DAYLIGHT (no extra spaces), matching TZID strings (e.g. Asia/Tehran or your chosen ID) and correct TZOFFSETFROM / TZOFFSETTO formats. Ensure DTEND uses the same TZID you used for DTSTART (your generator currently builds DTEND;TZID= without an ID).

Testing tips: save the generated .ics file, open it in a text editor and import into Outlook/Google Calendar to inspect how the client interprets DTSTART/DTEND. If problems persist, post the final ICS text (not the generator code) and one example date/time. Good starter pointer from — tutorials help, but the two points above are the root causes here for .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.