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

Datetime in Galleries

Hello,

 

I have a big problem with datetime data stored in SQL Server database, when I show in a Gallery this datetime data, It shows 5 hours late, for example data stored in database:

 

DataType datetime

2019-03-01 09:11:00.000

 

Information shown in the Gallery

1 marzo 2019 4:11

 

Thks.

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

It is a known issue/limit with datetime column in SQL Table. When you display datetime column value from a SQL table within an app, you may have the offset issue (Due to different time zone).

More details about the known issue/limit with datetime column in SQL table, please check the following blog:

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

 

As an alternative soluion, you could consider take a try to remove the datetime type column from your SQL table, instead, add a datetimeoffset type column in your SQL table to store the date time value.

 

In addition, I also agree with @RandyHayes 's thought almost. If you don't want to remove the datetime column value from your SQL table, I think the TimeZoneOffset() function and DateAdd() function could achieve your needs (mentioned within above blog I provided).

I have made a test on my side, please take a try with the following formula (set the Text property of the Label control in your Gallery to following😞

DateAdd(YourDateTimeColumn, -TimeZoneOffset(YourDateTimeColumn), Minutes) /* <-- YourDateTimeColumn represents the datetime column in your SQL table */

Or

DateAdd(YourDateTimeColumn, 5, Days)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
RandyHayes
Super User
Super User

@Anonymous 

Try to change your formula for them to the following:

   DateAdd(yourDateField, -TimeZoneOffset(yourDateField), Minutes)

 

It is a difference in the TimeZone offset you are most likely seeing, so the above should help.

You can get more info on the TimeZoneOffset function and other Time functions in the documents here.

 

Hope this is helpful.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

It is a known issue/limit with datetime column in SQL Table. When you display datetime column value from a SQL table within an app, you may have the offset issue (Due to different time zone).

More details about the known issue/limit with datetime column in SQL table, please check the following blog:

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

 

As an alternative soluion, you could consider take a try to remove the datetime type column from your SQL table, instead, add a datetimeoffset type column in your SQL table to store the date time value.

 

In addition, I also agree with @RandyHayes 's thought almost. If you don't want to remove the datetime column value from your SQL table, I think the TimeZoneOffset() function and DateAdd() function could achieve your needs (mentioned within above blog I provided).

I have made a test on my side, please take a try with the following formula (set the Text property of the Label control in your Gallery to following😞

DateAdd(YourDateTimeColumn, -TimeZoneOffset(YourDateTimeColumn), Minutes) /* <-- YourDateTimeColumn represents the datetime column in your SQL table */

Or

DateAdd(YourDateTimeColumn, 5, Days)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (4,688)