I have a Holiday calendar app. The gallery that displays the company holidays for the selected location is displaying a filtered collection of holidays that is gathered on App start from the SharePoint list. The date displayed is a Date/Time (Date Only) field.
I have reports from a few people that the dates being displayed are consistently 1 day earlier than they should be. We have checked numerous things from their computer time settings and browser settings but they are all normal.
In troubleshooting the app, I have used the TimeZone offset to capture the local time. Per MS by default it should show the current date/time without having to pass it a parameter, but it's not. Here is what it's displaying, note the bottom label is set to display the current date/time offset. The current time display remains the same regardless of when we look at it
Per Microsoft's documentation: "TimeZoneOffset defaults to the current time, so you don't need to pass it an argument."
TimeZoneOffset for Current Date/Time
"Current Time: " & Text(TimeZoneOffset(), ShortDateTime)
TimeZoneOffset for UTC Date/Time
"UTC Time: " & DateAdd(Now(), TimeZoneOffset(), Minutes)
Here is what we are seeing:
Here is what it should look like in the Power App:
Here is what the two users I am working with (1 in EST and 1 in CDT) are seeing:
If you can help me figure this out, I will be eternally grateful.
One thing to be careful of is using timezoneoffset with no parameter. You are correct that when you use it without parameter it will return the timezoneoffset for the current local time. But if you are then using that with a time that is from a different point in the year you will be off by an hour. timezoneoffset() needs a particular date as the parameter to decide what the current offset should be on that date for that location. Due to Daylight savings time that will vary across a year. So timezoneoffset called without a parameter in July will be different than timezoneoffset called in January. Unless you are working with the current date and time I would recommend always adding the date you are looking at as a parameter in timezoneoffset.
Right now it's there just for context to determine what is being seen by each of the people experiencing the issue. So I need it to be the current time. I can certainly pass Now() to it and see if that makes a difference but according to MS I shouldn't have to.
I added it as an additional piece of information to determine why some people are seeing the date in the list of holidays as a day earlier. So if the date in the SharePoint list is 1/3/2022, these people are seeing 1/2/2022.
You say one user is in EST and one in CDT. Shouldn't it be EST and CST? For the Central timezone user if the Date/time is coming in as midnight 12/30 Eastern time then that is actually 11PM 12/29 in the Central timezone. But I'm not sure what is happening for the EST user.
CDT is Central Daylight Time as opposed to Central Standard Time.
I could understand this if everyone in the CDT/CST were seeing the dates as a day earlier. However they aren't. 99.9% of the people are seeing the dates as they should be. And that doesn't explain why my user whose time zone is EST, which is the same setting in the SharePoint regional settings, is seeing them as a day earlier.
As I said, I can't explain the one in EST. But Timezone settings are managed at a lot of levels besides just SharePoint. I have to assume that something is set incorrectly for that one user's account somewhere. I don't know where.
My point about CDT is that right now the Central time zone is in CST. CDT doesn't start until March. I live in Central time zone US.
I only used CDT because that's what the user said his time zone is. We checked his browser settings and his computer settings and they are all accurate. So I don't have a clue here. I think I have 3 people who are experiencing the issue.
My last thought would be, Did you check his user profile settings in SharePoint? User's can override the sites time zone with their own personal time zone setting in their profile. I used to do it as a traveling trainer. But in general I don't recommend it because it can cause confusion just like you are seeing. I don't know that it is really surfaced anywhere anymore, but if you edit the user's profile in SharePoint Admin Center > More Features > User Profile Service you'll find a setting buried in their profile. That can change how SharePoint acts for that particular user.
I will have to look into that. Thanks for the tip
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
At the monthly call, connect with other leaders and find out how community makes your experience even better.