addDays vs addDaysUTC

In the documentation, addDaysUTC says it operates like addDays, except that it uses the UTC calendar and not the server's calendar. My server's calendar is 4 hours behind UTC My server's time is past 8PM. So technically, UTC is in tomorrow and server is in today. When I set my date using both addDays and addDaysUTC, it always delivers the same result. So question is, when do these 2 functions deliver 2 different answers? Since they don't deliver different answers, why do the UTC-functions exist? [EDIT - Ronald] So, I did some experiments based on Ronald's reply. It appears that it does not make any difference which function you are using as an engineer or dev, as soon as you have a date variable in hand, you can pass it to either non-UTC or UTC add functions and get the desired result: View expriment The only difference between the pink and blue bubbles are, that the input is initialized with a different time offset, but the functions UTC and non UTC on the outside add no difference.
3 answers

Whether you are in a UTC timezone or in another one a day will always be 24 hours and thus give you the same result. Except when a day time saving day is comming up. Then a day can suddenly have 23 or 25 hours. Thus than it suddenly matters in what timezone you are?

I did not try this as i have no modeler at hand but you could try the following. E.g say you are a dutch user with a +1 time zone. Then do a addDays(parseDateTime('2015-03-28 03:00:00','yyyy-MM-dd HH:mm:ss')

And do a addDaysUTC(parseDateTime('2015-03-28 03:00:00','yyyy-MM-dd HH:mm:ss')

i would expect that both fuctions would return different values here.


Hi Herman, they do actually deliver different results. But do note that the server's timezone is never used in any calculations anymore, if you don't use the *UTC version of the function, you will be using the timezone of the user that is currently executing that microflow, this might lead to different results than what you're expecting if you think it's in the server's timezone.


I think the result would be the same when you use the addDays function just to add a number of days (a day is a day no matter if it's UTC or not). But the result will be different when you use it like the example:

addDays(dateTime(2007, 1, 1, 1, 1, 1), 3) would differ from addDaysUTC(dateTime(2007, 1, 1, 1, 1, 1), 3).

The first one would produce a localized date while the other one produces a UTC date. So the usage depends on what kind of a date you start with.


Did some testing with the following options: addDays(dateTime(2014,10,7),1)



Option 1 and 2 give the same result (07-10-2014 22:00). Option 3 gives 08-10-2014 00:00.