`Days` and `Day` are easy to confuse

These may look like similar formulas, but

Date(2021, 11, 1) + Day(1) will return 12/2/2021

while

Date(2021, 11, 1) + Days(1) will return 11/2/2021

You probably want the second one. I don’t have a clue why Day(1) works like that.

2 Likes

Here’s the background:

What Day(1) does is first converts 1 to DateTime, resulting in 12/31/1899, then take a month day out of it, which is 31.

Days(x) sorta does nothing because 1 day = 1 as a number. It’s just syntactic sugar.

So Date(2021, 11, 1) + Day(1) is the same as Date(2021, 11, 1) + 31 and also the same as Date(2021, 11, 1) + Days(31)

But yes, easy to confuse.

1 Like

This seems really unintuitive.

Using Day()with just an input integer should throw a warning by default and ask if you meant to use Days()

Well, but if you are inputting something that’s measured in months or hours it’s pretty useful.