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

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (35,786)