addDaysUTC - wrong # of days?

0
Hi – I’m using addDaysUTC in a microflow to add a hard-coded 5 days to a datetime variable. Below is my expression. The results are inconsistent, e.g., if the input variable is 10/31/2019, then addDaysUTC returns 11/4/2019. Then if the input variable is 11/30/2019, addDaysUTC returns 12/4/2019. What am I doing wrong?   trimToDaysUTC(addDaysUTC(trimToDaysUTC($Dt_Instance), 5))
asked
3 answers
3

Since november only has 30 days, I don’t see the inconsistancy. Did you look at the dates in the debugger? They will show up including a time component. What is this time component saying?

answered
1

Thank  you for the tip … I realized I needed to add 6 days instead of 5 days because I am trimming the datetime (so that I get 11/5/2019 from input 10/31/2019).

answered
0

As Andreas says, the date looks correct.

If you need the 5th of next month, you could calculate it by using TrimToMonthsUTC on your current date, adding one month to this using AddMonthsUTC, and finally adding 4 days using AddDaysUTC.

Hope this helps.

answered