cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sam_sonepar
Helper III
Helper III

Timezone Change Adding Time on Existing Records

Hello all,

 

As of today, it is March 12 in the Eastern Timezone.

If I try to add, edit or view an item for today (Mar 12), there is no problem.

 

But if I try to edit an existing item whose date is set on March 15 (after we advance the time), it shows me that the time is now 1h later. This only seem to affect the items where the date is setup on March 15 and later.

 

My data is coming from SharePoint where the regional setting are in UTC.

 

The data table has this code on the appointment column:

Text(
    DateAdd(
        ThisItem.AppointmentDate,
        TimeZoneOffset(ThisItem.AppointmentDate),
        Minutes
    ),
    DateTimeFormat.ShortDateTime,"en-US"
)

It is displaying the information correctly regardless of the day.

 

On my Edit Screen, I funnel the date to actually appear in a single dropdown that contains the hour and the time in chunks of 30 minutes.

Here's the default value:

Text(
    DateAdd(
        First(colSelectedEdit.AppointmentDate).AppointmentDate,
        TimeZoneOffset(),
        Minutes
    ),
    "[$-en-US]hh:mm"
)

 

Here's the Item value

[
    "06:00",
    "06:30",
    "07:00",
    "07:30",
    "08:00",
    "08:30",
    "09:00",
    "09:30",
    "10:00",
    "10:30",
    "11:00",
    "11:30",
    "12:00",
    "12:30",
    "13:00",
    "13:30",
    "14:00",
    "14:30"
]

I use hidden labels to manipulate the string and extract the values I want to Patch the info, but that's beside the point.

 

The Edit Screen has multiple fields that show the item selected in the table but the appointment will show it 1 hour later by default.

If the item is saved, the new time gets updated in SharePoint. To avoid that, we need to manually change the time back to what it was.

 

I suspect the problem is in the function (TimezonOffset) but I'm not sure where to go from there.

Any help is appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User III
Dual Super User III

The TimeZoneOffset automatically adjusts for Daylight savings time.  But in your default your don't specify a time inside the TimeZoneOffset.  So in that case it defaults to the Timezone offset for Today().  Change your default setting to the following:

Text(
    DateAdd(
        First(colSelectedEdit.AppointmentDate).AppointmentDate,
        TimeZoneOffset(First(colSelectedEdit.AppointmentDate).AppointmentDate),
        Minutes
    ),
    "[$-en-US]hh:mm"
)

That should properly adjust the TimeZone Offset for the date being processed.

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

2 REPLIES 2
Pstork1
Dual Super User III
Dual Super User III

The TimeZoneOffset automatically adjusts for Daylight savings time.  But in your default your don't specify a time inside the TimeZoneOffset.  So in that case it defaults to the Timezone offset for Today().  Change your default setting to the following:

Text(
    DateAdd(
        First(colSelectedEdit.AppointmentDate).AppointmentDate,
        TimeZoneOffset(First(colSelectedEdit.AppointmentDate).AppointmentDate),
        Minutes
    ),
    "[$-en-US]hh:mm"
)

That should properly adjust the TimeZone Offset for the date being processed.

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Once again, you saved the day Paul 👑

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,024)