cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jrowe
Level: Powered On

Time in textbox not showing same time as sql data

I have textboxes in my app that are pulling date/time data from our sql database. The sql database has 3/15/2017 11:27:34 AM, the textbox displays 3/15/2017 7:27:34 AM.  The textbox is set to display Parent.Default, how can I get this to show the correct time? I can get it to display correctly by using ThisItem.Created + 4/24 on the parent but if I do that then I have to update the app everytime we go through the stupid daylight savings change.

3 REPLIES 3
PowerApps Staff AndyPennell
PowerApps Staff

Re: Time in textbox not showing same time as sql data

The SQL datetime is in UTC so it is being correctly converted to local time when displayed. If you want to see it in UTC then try

Text(ThisItem.Created, "UTC")
jrowe
Level: Powered On

Re: Time in textbox not showing same time as sql data

The SQL time is in local time not UTC. That's the problem, Powerapps is converting it when it shouldn't. I got rid of the problem by converting the column to varchar instead of datetime so Powerapps will leave it alone and just display the data. We use this database with other applications and it's all local so using UTC will only cause problems when it's not needed.

PowerApps Staff AndyPennell
PowerApps Staff

Re: Time in textbox not showing same time as sql data

How can it be in local time if its on a SQL Server? Where is the server located?? Most data sources store datetime in UTC because that is the only format that makes any sense. (Excel is the exception, which stores datetime in a timezone-less way which has its own unique problems). What if one client of the DB is on the East coast, and another on the West coast? They both need to read the datetime and get the same value, which has to be UTC. Both can covert to local time for display purposes, which is what my sample did.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,437)