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

Adding hours to date.

Hello all,

 

What I am trying to accomplish is a text box that shows a new date stemming from hours added onto the date selected.  In excel I was using:

=IF(D81="","",IF(AND(ISNUMBER(D81),F81=""),$C$77+(D81/24),IF(ISNUMBER(F81),$C$77+(F81/24))))

 

Thanks in advance for the assistance.

 

 

Date+Hours.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Adding hours to date.

Hi @Sevendust,

Could you please share a bit more about your scenario?

Do you want the End Date/Time to be equal to selected date (e.g. '10/25/2018 18:30 ') plus actual hours?

If you want the End Date/Time field to be equal to selected date (e.g. '10/25/2018 18:30 ') plus actual hours within your Edit form, I think the DateAdd function could achieve your needs.

I have made a test on my side, please take a try with the following workaround:14.JPG

Set the Default property of the End Date Data card to following formula:

If(
IsBlank(Actual_x0020_Hours_DataCard2.Update),
Start_x0020_Date_DataCard2.Update,
DateAdd(Start_x0020_Date_DataCard2.Update,Actual_x0020_Hours_DataCard2.Update,Hours)
)

Note: The Start_x0020_Date_DataCard2 represents the Start Date Data card control, the Actual_x0020_Hours_DataCard2 represents the Actual Hours Data card control.

The GIF screenshot as below:Test1.gif

 

 

More details about the DateAdd function in PowerApps, please check the following article:

DateAdd function

 

Best regards,

Kris

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

4 REPLIES 4
HadynM
Level 8

Re: Adding hours to date.

Hi @Sevendust

The DateAdd function sounds like what you're after:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff

Use it like:

DateAdd(StartDate,Value(ActualHours),Hours)

Hope that helps

Hadyn

Community Support Team
Community Support Team

Re: Adding hours to date.

Hi @Sevendust,

Could you please share a bit more about your scenario?

Do you want the End Date/Time to be equal to selected date (e.g. '10/25/2018 18:30 ') plus actual hours?

If you want the End Date/Time field to be equal to selected date (e.g. '10/25/2018 18:30 ') plus actual hours within your Edit form, I think the DateAdd function could achieve your needs.

I have made a test on my side, please take a try with the following workaround:14.JPG

Set the Default property of the End Date Data card to following formula:

If(
IsBlank(Actual_x0020_Hours_DataCard2.Update),
Start_x0020_Date_DataCard2.Update,
DateAdd(Start_x0020_Date_DataCard2.Update,Actual_x0020_Hours_DataCard2.Update,Hours)
)

Note: The Start_x0020_Date_DataCard2 represents the Start Date Data card control, the Actual_x0020_Hours_DataCard2 represents the Actual Hours Data card control.

The GIF screenshot as below:Test1.gif

 

 

More details about the DateAdd function in PowerApps, please check the following article:

DateAdd function

 

Best regards,

Kris

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

Sevendust
Level: Powered On

Re: Adding hours to date.

You are AWESOME!!!! Much thanks!!

AndersIskov
Level: Powered On

Re: Adding hours to date.

@v-xida-msft

 

This is such a terrific way to help, thank you! However, I do not know why but looking at many of the syntax in these forum posts seems to not working in my new version of PowerApps fx.: If(IsBlank(xxxxxx.Update).....

 

I do not know why but the function does not work - Can you give me a hint as to why although I am using the exact same method as you have in the Gif/your screenshot? Greatly appreciated, thank you!

 

 

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

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