Hi Community
I have a problem that i don't really know the best way to solve, done some searching and nothing gave me the kind of answer i wanted
I have a desk booking app that allows user to pick a date and time, using a SharePoint list as the Data Source and using outlook connector to create meeting invites. It all works great when the users are in a single timezone. but when users are in a different time zone things start to fall apart.
The "Home" time zone is UTC +10 (During daylight savings UTC +11) then will have users from UTC +8 UTC +9:30.
What i am looking for is regardless of where a user is, the data needs to be saved in the Home time zone. ie. if a user in UTC+8 and books a desk for 8AM it should save as 8AM in the Home time zone and not the users time zone
and be able to cater for the change in daylight savings
Cheers
Solved! Go to Solution.
I will need to see the code that sends the date to SharePoint to work out what's happening, I think?
I made a dummy setup like the below and using DateTimeValue() and TimeZoneOffset() you can get a UTC time that you can then just add +10/+11 depending on the time of year.
With Daylight Saving months (I'm assuming with a name like BlessedCobba you are in Oz 🙂 ), hence the DLSMs are: Start = 4 (Apr) and End = 10 (Oct), which can be used in an If() condition to set a variable in the App OnStart, eg
Set( vUTCHomeHrs,
If(
Month(Today()) in [4,5,6,7,8,9],
10,
11
)
)
Hi @BlessedCobba ,
The TimeZoneOffset Function returns the difference between the User's device and UTC. It is just a matter of adding/deducting the difference before writing the data taking into account the home time zone.
What have you tried so far? Have you tried incorporating TimeZoneOffset() into your app design? This function returns ' ... the number of minutes between the user's local time and UTC (Coordinated Universal Time). ...'
For example
TimeZoneOffset( Now() ) in +10 UTC returns -600 (mins) - this could be used as a conditional check in your code like
If(
TimeZoneOffset( Now() ) <> -600,
// then
... then adjust for non-Home Zone times ...,
// else
... use users time selected ...
)
Also, how are you letting users pick dates/times? Is it with dropdowns for times eg
1 x dropdown for hrs
1 x dropdown for mins
??
And, what is happening now in the data ie
User selects 8AM, in +8 UTC --> what gets added to SP as the time?
I was trying to get away with "hardcoding" it as we switch to daylight savings twice a year and that would require updating the code after the change to be UTC +11 instead of its current UTC 10 then back to UTC 10 after daylight savings ends
The drop down is a simple pick an hour, no minutes
If the User selects 8AM in UTC 8 it saves and 10AM in the SharePoint as that is set to UTC 10,
it also then creates the meeting invite at 8AM UTC 8, then when they travel to the other time zone it becomes 10AM UTC 10
I will need to see the code that sends the date to SharePoint to work out what's happening, I think?
I made a dummy setup like the below and using DateTimeValue() and TimeZoneOffset() you can get a UTC time that you can then just add +10/+11 depending on the time of year.
With Daylight Saving months (I'm assuming with a name like BlessedCobba you are in Oz 🙂 ), hence the DLSMs are: Start = 4 (Apr) and End = 10 (Oct), which can be used in an If() condition to set a variable in the App OnStart, eg
Set( vUTCHomeHrs,
If(
Month(Today()) in [4,5,6,7,8,9],
10,
11
)
)
@EddieE
Ahhh the variable is the missing component to help with my set and forget
I used your variable and here is the patch button
//See if the user is in the home timezone, if so just send the datetime, if they are not, do the math to convert to home time zone and then send
CheckOutFrom: If(TimeZoneOffset(Now())/60 = vUTCHomeHrs, startTime, DateAdd(startTime,vUTCHomeHrs-TimeZoneOffset(Now())/60,Hours)),
CheckOutTo: If(TimeZoneOffset(Now())/60 = vUTCHomeHrs, endTime, DateAdd(endTime,vUTCHomeHrs-TimeZoneOffset(Now())/60,Hours)),
User | Count |
---|---|
262 | |
110 | |
98 | |
54 | |
39 |