addDays function to last week of 2018 and expected result week dates in 2019

Hi everybody, I would like to have a Date of 24/12/2018 (dd/MM/yyyy) and use addDays to add let's say 9 days which should result in 03/01/2019, but as far as I can see it just resets to the January 2018 date, instead of going to 2019. I am not sure if the function is supposed to automatically go to the 2019 year or if I'm doing something wrong.  Could you please give me some feedback on this as per your experience with it? Much appreciated! Thanks, Razvan
2 answers

Hi Razvan,

The addDays functionality will move the date into 2019, as you would expect. You can test this by making a simple microflow that does the following:

- Create a Date and time variable (I named it $Date) with value: dateTime(2018, 12, 24, 12, 0, 0)

- Change the variable: addDays($Date, 9)

If you debug this microflow, you will see the following value after the change variable activity:

UTC time: 2019-01-02 10:00:00.000
Session time: 2019-01-02 12:00:00.000 +0200

If you are getting different results in your current setup, either [%BeginOfCurrentWeekUTC%] or $WeekDifferenceInDays is incorrect (or both). My guess is that the date & time on the machine you're developing on (or the server where you are testing) might not be set correctly.

Good luck!


Hi Razvan,

Did you already check out the documentation on 'Add date function calls'?

In your case probably: addDays($yourDate, 9) , uses the server's calendar

or for UTC: addDaysUTC($yourDate, 9) , uses the UTC calendar