Hello, what I am trying to do is display a sharepoint list in a power apps gallery.
the issue is that the date column is sharepoint is not display correctly in the power app, for example in sharepoint I have "20/11/2019 7:30" and when I call it from power apps using ThisItem function, I get "20/11/2019 10:30", it has 24 hour format and dd/mm/yyyy format.
Any help or suggestions on how to aproach this would be great, thanks!
This is usually because of a shift from UTC time to the local timezone. Make sure that both sides are formatting the date to show in the same timezone.
If you print out the date and time in a label using the full UTC formatting is should convert everything to UTC. Like this
Just replace DatePicker1.SelectedDate with whatever your date is. That should show you whether the dates/Times are actually the same or not. If they are then you can do some math using DateAdd() and TimeZoneOffset() to adjust as needed.
In sharepoint is 16/08/2019 7:00
In power app, with ThisItem.Date I get 16/08/2019 9:00
now, with Text(ThisItem.'Date';DateTimeFormat.UTC;"en-US"), I get 2019-08-16-T14:00:00.000Z.
I do not quite get how to change it
The 'Z' at the end designates that the date time value is now being displayed in the UTC timezone, which is +/- 0. Depending on where you are located you can use DateAdd() to add minutes to that to get a datetime value for your local timezone and display that.
Where are you located? If I can figure out your local timezone I can give you an example. SharePoint tries to do this adjustment for you automatically, which is why I think you are getting a different result in PowerApps.
Columbia is GMT -5 hours. So if your time in UTC is 2019-08-16-T14:00:00.000Z in UTC then it would be 2019-08-16-T9:00:00.000 (14-5) in local time, which is what is displayed in PowerApps. Seattle is GMT -7 hours right now. So since the default setting for SharePoint online Seattle time, SharePoint displays the time as 2019-08-16-T7:00:00.000 (14-7). You can change the REgional Settings of the site collection to Columbia's Timezone at which point SharePoint will show the same time as PowerApps. Here's an article on how to change the timezone settings for a site.
Hi @Anonymous ,
Is the Time zone/Locale value of your SP Site set to same value as that in your local time zone (as your PC)?
Based on the issue that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. According to the issue that you mentioned, I think this issue is related to time zone.
On your side, please check if the Time zone/Locale value of your SP Site set to same value as that in your local time zone (as your PC). Please go to the "Site Settings" of your SP Site -> "Regional Settings", then configure Time Zone property and Region property as below:
Please consider take a try with above solution, then re-generate a new app based your SP List, then check if the issue is solved.