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

2 PowerApps submit different timestamps with the same code

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.

1 ACCEPTED SOLUTION

Accepted Solutions
MangoMan09
Helper II
Helper II

After a bit of digging I found out that the issue was in the App's advanced settings.

The older app had the Enhanced Microsoft SQL Server connector disabled, and the newer one had it enabled.

We disabled it on the newer one and the values are now matching.

View solution in original post

2 REPLIES 2
mogulman
Skilled Sharer
Skilled Sharer

What is the underlying datatype is SQL table? It should be datetimeoffset. 

 

	[ModifiedDate] [datetimeoffset] NULL

 

Update it with Now().  PowerApps take care of all offsets including DST.

MangoMan09
Helper II
Helper II

After a bit of digging I found out that the issue was in the App's advanced settings.

The older app had the Enhanced Microsoft SQL Server connector disabled, and the newer one had it enabled.

We disabled it on the newer one and the values are now matching.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,249)