cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lstod
Frequent Visitor

Date Picker Changes to Wrong Date

I am having an issue that i've been struggling with for the past few hours with regards to the Date Picker Data card.  I have a simple form that has a start date pre-populated and I want to allow the user to edit the date and then submit it to be recorded in an excel document.

 

Everytime I select a new date and update the form, it changes the date to a day prior.  After doing some research, I think it has something to do with UTC/Local date/time conversions, but I have been unable to get any of the workarounds to work.  I would be really grateful for any help you could provide. 

1 ACCEPTED SOLUTION

Accepted Solutions
lstod
Frequent Visitor

In case this helps anyone else....I was able to figure out the solution to the issue I was having.

 

When a User interacted with the Date picker in PowerApps it triggered an approval flow that updated dates in an excel spreadsheet. 

The flow converts all date/times to UTC and stored it in the spreadsheet with a timestamp of 0:00.

The data then flowed back to PowerApps where the Date Picker was set to use "local time", which for me subtracted 4 hours from the UTC date and caused the date to change to 1 day prior due to the time difference.

 

Solution: Set the Default of the Date DATA CARD (not the Default Date on the Date picker) to

DateAdd(Thisitem.'StartDate', 5, Hours)

View solution in original post

3 REPLIES 3
RezaDorrani
Dual Super User II
Dual Super User II

Hi @lstod 

 

check this blog

https://toddbaginski.com/blog/working-with-local-and-utc-dates-and-times-in-powerapps/

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Thanks for your quick reply!  I'm still pretty new to powerapps and I read the link you provided.  I updated my date picker to be UTC format, but in the app  he used a label to display the "adjusted" date with the Text Parameter set as:

 

 DateAdd(UTCDatePicker.SelectedDate, TimeZoneOffset(UTCDatePicker.SelectedDate), Minutes)

 

I would like the adjusted date to be displayed in the date picker, which parameter would I do that under?  I tried DefaultDate, but that was not right.

lstod
Frequent Visitor

In case this helps anyone else....I was able to figure out the solution to the issue I was having.

 

When a User interacted with the Date picker in PowerApps it triggered an approval flow that updated dates in an excel spreadsheet. 

The flow converts all date/times to UTC and stored it in the spreadsheet with a timestamp of 0:00.

The data then flowed back to PowerApps where the Date Picker was set to use "local time", which for me subtracted 4 hours from the UTC date and caused the date to change to 1 day prior due to the time difference.

 

Solution: Set the Default of the Date DATA CARD (not the Default Date on the Date picker) to

DateAdd(Thisitem.'StartDate', 5, Hours)

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (1,645)