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

DateAdd formula formula won't work

I am trying to add hours to a start time to mark the end of an appointment (meeting starts at 2:00PM and ends at 3:00PM).  I've created a drop down with 1/2 hour increments and after the selection is made, I wish to add the duration time (stored in a seperate control), to the start time to get the end.

 

I have entered this formula into a seperate control to get my time:

 

DateAdd(TimeValue(ddSelectTime.Selected.Value), Value(txtDuration.Text), Hours).

 

If I change the bolded/underlined section in the above formula to Now(), it works great.  Help!!!

Capture.JPG

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
samuelJ
Level 8

Re: DateAdd formula formula won't work

I believe you need to enter a DateTime value.  If I am understanding your code correctly:

ddSelectTime.Selected.Value

is just the value: "7:30 AM".  You should pass the full DateTime: "12/28/2018 7:30AM".  

 

kmflanagan
Level: Powered On

Re: DateAdd formula formula won't work

Thank you for the response and indeed, that was the problem.  I got so focused on needing the time to change, I forget to pass the date!!!

 

Thanks for your help!

2 REPLIES 2
Highlighted
samuelJ
Level 8

Re: DateAdd formula formula won't work

I believe you need to enter a DateTime value.  If I am understanding your code correctly:

ddSelectTime.Selected.Value

is just the value: "7:30 AM".  You should pass the full DateTime: "12/28/2018 7:30AM".  

 

kmflanagan
Level: Powered On

Re: DateAdd formula formula won't work

Thank you for the response and indeed, that was the problem.  I got so focused on needing the time to change, I forget to pass the date!!!

 

Thanks for your help!

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 198 members 5,446 guests
Please welcome our newest community members: