web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / SQL datetime wrong dis...
Power Apps
Answered

SQL datetime wrong display

(0) ShareShare
ReportReport
Posted on by 284

Hi,

I saw many people having problem with storing date time in SQL Server DB (on Premise). I am having a field "UpdatedOn" with datatype varchar(20). I follow the method mentioned in this link below but it does not solve my problem.

https://powerapps.microsoft.com/en-us/blog/working-with-datetime-values-in-sql/ 

 

I am setting "Text(Now(), "[$-en-GB]yyyy-mm-dd hh:mm:ss")" in the update parameter on the UI for "UpdatedOn". On the screen when I printed the Now() value is show "23/04/2020 14:43" but in the SQL DB it is showing "2020-04-22 23:43:06". My data type is varchar so why still stored the datetime in different time zone? Any advise?

Categories:
I have the same question (0)
  • mogulman Profile Picture
    764 on at

    I had this exact problem.  PowerApps operates on UTC time.  You would think Now() is your time but it is UTC time.  This problem is easily fixed.  When you create table rather then use datetime data type use datetimeoffset.  Don't save as string.

     

    	[ModifiedDate] [datetimeoffset] NULL

     

    When you save Now() I think the connector sees the offset and adds in your timezone to the UTC time.  This takes in DST.

  • sbgoh Profile Picture
    284 on at

    Hi, I also tried set datetimeoffset(7) but do I need to save the current date time as "DateAdd(Now(), -TimeZoneOffset(Now()), Minutes)" or just "Now()"?

     

  • Verified answer
    sbgoh Profile Picture
    284 on at

    After I changed the data type to "datetimeoffset", and save the updatedOn file as "Now()", the display is ok now. Maybe I need to refresh the table since I have alter it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 494

#2
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#3
11manish Profile Picture

11manish 323

Last 30 days Overall leaderboard