cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
newpauser
New Member

addHours to Form response Date

I have a Holiday Request Flow which the user fills out a Form > Admin Approve via Email > it then adds event to a Group Calendar but if the user only requests 1 day off I get the error below:

 

"Your request can't be completed. The duration of an event marked as All day must be at least 24 hours.

 

I think its creating the event for liek 00:01 to 23:59 or something along them lines so (I think) I need to add an hour or a few minutes onto the Form EndDate so its over 24 hours. However I cant work out how to link Dynamic Content + Expression like addHour(1). I cant find a way to get the code for the Form EndDate box to add into the expression.

 

Any pointers appreciated, screen below of the flow part that I'm struggling with:Annotation 2020-08-04 162942.jpg

2 ACCEPTED SOLUTIONS

Accepted Solutions
JohnAageAnderse
Super User
Super User

Hello @newpauser 

If you are creating an all day event, then you can ignore the end date.

Just make sure you have entered Yes in the Is All Day under the Advanced options.

In the Start time field, enter the expression "formatDateTime(<your start date column>,'yyyy-MM-dd')" - this will give you the date at midnight.

In the End time field, enter the expression "formatDateTime(addDays(<your start date column>,1),'yyyy-MM-dd')" - this will give you the next date at midnight.

The above works for me 🙂

 

Edited: If the event is for more than one day, then the last expression in the End time field must use <your end date column> instead of the <your start date column>!

 

Note that the reason that I am using formatDateTime is due to an All Day event must provide a Start time/End time that is at midnight, so I am just cutting off the time to do that 🙂

Kind regards, John

View solution in original post

v-alzhan-msft
Community Support
Community Support

Hi @newpauser

 

Does your issue still exists?

You should refer to screenshot below to create the flow:

1.png

addHours(outputs('Compose'),1)

 

Best Regards,

Alice

 

Community Support Team _ Alice Zhang
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

5 REPLIES 5
Jcook
Super User III
Super User III

Hello @newpauser 

 

In your End Time:

In your expression addHours()

You want to do this:

addHours(<Your Dynamic Content>,1)

so in very simple terms,

Type your expression,

Click the dynamic tab,

Select your dynamic content with the End Time,

At the end of the expression put a comma ,

Than the amount of hours 1

Click OK

Jcook_0-1596564937522.png

 

Jcook_1-1596565036917.pngJcook_2-1596565058622.png

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





PrasadAthalye
Super User
Super User

See if you can use following functions AddToTime, SubtractFromTime...

 

PrasadAthalye_0-1596565302930.png

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community
JohnAageAnderse
Super User
Super User

Hello @newpauser 

If you are creating an all day event, then you can ignore the end date.

Just make sure you have entered Yes in the Is All Day under the Advanced options.

In the Start time field, enter the expression "formatDateTime(<your start date column>,'yyyy-MM-dd')" - this will give you the date at midnight.

In the End time field, enter the expression "formatDateTime(addDays(<your start date column>,1),'yyyy-MM-dd')" - this will give you the next date at midnight.

The above works for me 🙂

 

Edited: If the event is for more than one day, then the last expression in the End time field must use <your end date column> instead of the <your start date column>!

 

Note that the reason that I am using formatDateTime is due to an All Day event must provide a Start time/End time that is at midnight, so I am just cutting off the time to do that 🙂

Kind regards, John

View solution in original post

v-alzhan-msft
Community Support
Community Support

Hi @newpauser

 

Does your issue still exists?

You should refer to screenshot below to create the flow:

1.png

addHours(outputs('Compose'),1)

 

Best Regards,

Alice

 

Community Support Team _ Alice Zhang
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

thanks this worked as you mentioned with the edit part as I needed it to be either 1 full day or multiple.

 

Thanks everyone else who took the time to comment aswell!

Helpful resources

Announcements
User Groups Public Preview

Join us for our User Group Public Preview!

Power Automate User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (53,965)