Difference of a day in %ICUDateTimeFor%

Can anyone explain this? I would think it might be a daylight saving thing, but I am in GMT, or at least BST, I can't keep up! I seem to be feeding the ICUDateTime the variables for one date, but when I try to convert it, it gives me the day after.

OK, as usual, my searches before posting confused me, my searches after revealed a solution, though I still don't understand. I added the hours to the formula like this:
%ICUDateTimeFor% TIME(pgnyear, pgnmonth, pgnday, 12, 12, 0) %MMM d, yyyy%

and I now get the desired result (Aug 17, 1895 in this case).

Just looking at the KM Wiki which says about the TIME function

Keep in mind that TIME is in GMT and the output of %ICUDateTimeFor% is in local time, so when doing this sort of thing it is best to use midday instead of midnight:

%ICUDateTimeFor% TIME(2015, 8, 23,12,0,0) %EEE, MMM d, yyyy%

which will generally work anywhere since at midday GMT, the entire world (almost) is on the same date. Otherwise, folks with negative GMT offsets (which includes all of the Americas for example) will get the wrong result.

which explains what’s going on!

1 Like

Ah yes, the Wiki! I did look, and that rings a bell, maybe it was in the back of my mind because I ended up using the same solution.


1 Like