cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mayarnaldo15
Helper I
Helper I

Incrementing date variable

Hi,

 

I have flow that create new item when user specify the frequency (daily, weekly, monthly and yearly) and number of occurrence. The chosen date should increment based on number of occurrence. For example:

chosen date: 11.21.2021

frequency: daily

number of occurrences: 3

 

Here's the flow:

increment_01.jpg

 

Here's how I set the Date:

addToTime(triggerOutputs()?['body/Date'],variables('counter'),'Day','yyyy-MM-dd')

 

 

However, the output is not what I am expecting. The date is copying the original entry (11/21/2021). The next date should be 11/22/2021 then 11/23/2021.

 

But when I tried the utcNow(). It works perfectly.

 

addToTime(utcNow(),variables('counter'),'Day','yyyy-MM-dd')

increment_02.jpg

 

 

 

Can someone help me on how to fix this? 

 

Any help is appreciated! 🙂

 

Regards,

M

1 ACCEPTED SOLUTION

Accepted Solutions
AIMEN_promero
Frequent Visitor

Try formatting the  triggerOutputs()?['body/Date']  before operating it. It happened to me often that, if you have a simplified date format in your columns, they don't perform well as dates in the operations.

 

You can use convertToUtc()

 

 

 

addToTime(convertToUtc(triggerOutputs()?['body/Date']),variables('counter'),'Day','yyyy-MM-dd')

 

 

 

Sounds silly, but it works for me.

View solution in original post

2 REPLIES 2
AIMEN_promero
Frequent Visitor

Try formatting the  triggerOutputs()?['body/Date']  before operating it. It happened to me often that, if you have a simplified date format in your columns, they don't perform well as dates in the operations.

 

You can use convertToUtc()

 

 

 

addToTime(convertToUtc(triggerOutputs()?['body/Date']),variables('counter'),'Day','yyyy-MM-dd')

 

 

 

Sounds silly, but it works for me.

View solution in original post

Hi @AIMEN_promero 

 

It works here too! 🙂

Thank you!

 

Regards,

M

Helpful resources

Announcements
Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,459)