cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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
Anonymous
Not applicable

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
Impactful Individual
Impactful Individual

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.

Anonymous
Not applicable

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.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,744)