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

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (48,197)