When developing 2 apps for a QnA project I came across to this strange situation where 2 different Apps patch to the same SQL table with the same patch statement but the submitted timestamp is different between the apps.
Initially I thought it could be due to time zones as people could be submitting questions across the globe. In order to correct it, I guaranteed that the patch was always saving in UTC.
Patch(
'[dbo].[PERSONALCOACH_THREADREPLY]',
Defaults('[dbo].[PERSONALCOACH_THREADREPLY]'),
{
PT_USER_ID: varCurrentUser.PRIMARYID,
PT_THREAD_ID: galThread.Selected.PT_PRIMARYID,
PT_DESCRIPTION: RichTextEditorThreadReply.HtmlText,
PT_DATETIME: DateTimeValue(
Text(
Now(),
DateTimeFormat.UTC
)
)
}
)
In the app that UTC timestamp could later be transformed based on the users time zone using
DateAdd(ThisItem.PT_DATETIME,-TimeZoneOffset(),Minutes)
When I ran some tests the results were positive in one App but when I tested on the other one the results were always ahead by 1 hour.
I have no clue on why this is happening. The code is the same and interacting with the same Data source.
The only difference that I could even find is that one App was created by me and the other app was created by a colleague whose time zone is actually 1 hour ahead of mine.