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

Change hour coming from SharePoint

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!

9 REPLIES 9
Dual Super User
Dual Super User

Re: Change hour coming from SharePoint

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 I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Anonymous
Not applicable

Re: Change hour coming from SharePoint

Thanks for the reply. where do I look to check that?

Dual Super User
Dual Super User

Re: Change hour coming from SharePoint

If you print out the date and time in a label using the full UTC formatting is should convert everything to UTC.  Like this

Text(DatePicker1.SelectedDate,DateTimeFormat.UTC,"en-US")

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.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Anonymous
Not applicable

Re: Change hour coming from SharePoint

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

Dual Super User
Dual Super User

Re: Change hour coming from SharePoint

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.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Anonymous
Not applicable

Re: Change hour coming from SharePoint

I am located in colombia

Siriyala
Regular Visitor

Re: Change hour coming from SharePoint

As you have 2 hours time difference, you can substract 2 hours using DateAdd().

Try following formula

DateAdd(This.'Date',-2,Hours)

Dual Super User
Dual Super User

Re: Change hour coming from SharePoint

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.

https://sharepointmaven.com/sharepoint-time-zone/



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Community Support
Community Support

Re: Change hour coming from SharePoint

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:9.JPG

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.

 

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
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (8,707)