web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / OfficeOutlook365.V4Cal...
Power Apps
Answered

OfficeOutlook365.V4CalendarPostItem and handling DST (Daylight Saving Time).

(0) ShareShare
ReportReport
Posted on by 187

Hi all,

Trying to solve the following puzzle.


In my app the user can select a start date for an appointment, then in a separate dropdown the starthour of the appointment (from 0-23) and the startminutes of the appointment (00,15,30,45).
The same for the end time of the appointment.

I use the following code to send it to Outlook whereby the part in Italic is not relevant, my struggle is with starttime, endtime, timezone.
Office365Outlook.V4CalendarPostItem(LookUp(Office365Outlook.CalendarGetTables().value, DisplayName = "Calendar").Name,
LookUp(Artists, ShopID = varShopID && Name = Dropdown5_1.Selected.Name,Initials)&":" & Dropdown4.Selected.Value &" " & varClientFirstName & " " & varClientLastName & " " & "€" & Value(InputPrice_1.Text),

Text(DateAdd(DateTimeValue(DatePicker1_3.SelectedDate & " " & TimeValue(Concatenate(DDStart_8.Selected.Value, ":", DDEnd_8.Selected.Value))),TimeZoneOffset(),TimeUnit.Minutes),"yyyy-mm-ddTHH:mm:ssZ"),
Text(DateAdd(DateTimeValue(DatePicker1_3.SelectedDate & " " & TimeValue(Concatenate(DDStart_9.Selected.Value, ":", DDEnd_9.Selected.Value))),TimeZoneOffset(),TimeUnit.Minutes),"yyyy-mm-ddTHH:mm:ssZ"),
"(UTC) Coordinated Universal Time");

I I book an appointment let's say for tomorrow 7th of September 2023, from 08.00-10.00, it will reflect as such in Outlook.
If I book the same appointment let's say on 10th of January 2024, it saves in Outlook as 07.00-09.00. I want it to reflect 08.00-10.00 as you can imagine.

I am in Amsterdam Timezone. I tried changing the "UTC Coordinated Universal Time" to "(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna", but that does not do the trick.

Any help is more then welcome how to deal with this, driving me nuts 🙂

Many thanks in advance!

Categories:
  • debarbanson Profile Picture
    187 on at

    @RandyHayes @WarrenBelz is this something you have come across and have a nice solution for? Do apologize for tagging but you have helped me out greatly in the past 🙂

  • Verified answer
    debarbanson Profile Picture
    187 on at

    Managed to get it sorted myself. just post the solution here for future references for others:

    // Set the SelectedDate variable
    Set(SelectedDate, DatePicker1_3.SelectedDate);

    // Calculate the start and end times without DST adjustment
    Set(StartTime, DateTimeValue(SelectedDate & " " & TimeValue(Concatenate(DDStart_8.Selected.Value, ":", DDEnd_8.Selected.Value))));
    Set(EndTime, DateTimeValue(SelectedDate & " " & TimeValue(Concatenate(DDStart_9.Selected.Value, ":", DDEnd_9.Selected.Value))));

    // Check if the selected date falls within a DST transition period for each year (2023 - 2026)
    If (
    (SelectedDate >= DateValue("2023-03-26") && SelectedDate < DateValue("2023-10-29")) ||
    (SelectedDate >= DateValue("2024-03-31") && SelectedDate < DateValue("2024-10-27")) ||
    (SelectedDate >= DateValue("2025-03-30") && SelectedDate < DateValue("2025-10-26")) ||
    (SelectedDate >= DateValue("2026-03-29") && SelectedDate < DateValue("2026-10-25")),
    // Adjust times by subtracting 2 hours for DST transition period
    Set(StartTime, DateAdd(StartTime, -2, TimeUnit.Hours));
    Set(EndTime, DateAdd(EndTime, -2, TimeUnit.Hours)),
    // If not within a transition period, adjust times by subtracting 1 hour
    Set(StartTime, DateAdd(StartTime, -1, TimeUnit.Hours));
    Set(EndTime, DateAdd(EndTime, -1, TimeUnit.Hours))
    );

    and then for the posting to outlook:
    ffice365Outlook.V4CalendarPostItem(
    LookUp(Office365Outlook.CalendarGetTables().value, DisplayName = "Calendar").Name,
    LookUp(Artists, ShopID = varShopID && Name = Dropdown5_1.Selected.Name, Initials) & ":" & Dropdown4.Selected.Value & " " & varClientFirstName & " " & varClientLastName & " " & "€" & Value(InputPrice_1.Text),
    Text(StartTime, "yyyy-mm-ddTHH:mm:ssZ"),
    Text(EndTime, "yyyy-mm-ddTHH:mm:ssZ"),
    "(UTC) Coordinated Universal Time"
    );

    This will work until 2026, before that I will set a reminder to update for the coming 3 years the transition dates of DST

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard