Everything not displaying correct 1st sunday of a month

Discussion related to "Everything" 1.5.
anmac1789
Posts: 747
Joined: Mon Aug 24, 2020 1:16 pm

Everything not displaying correct 1st sunday of a month

Post by anmac1789 »

Hello, in excel this formula works to find the 1st sunday of each month as I've tested this with dates in the middle of the month. My question is when I substitute this into everything, I get the wrong dates. See example

=DATE(YEAR(A1),MONTH(A1),DAY(A1))-DAY(DATE(YEAR(A1),MONTH(A1),DAY(A1)))+8-WEEKDAY(DATE(YEAR(A1),MONTH(A1),DAY(A1))-DAY(DATE(YEAR(A1),MONTH(A1),DAY(A1))))


image.png

You can see in the above screenshot, I just have a basic date

image.png

In the above screenshot, you can see that if I sub a date in the middle of the month it still gives me the 1st sunday of the month. However, when I substitute this into excel, I get something weird...

image.png

In this screenshot, all this did was that it "copied" the date modified into column1. So what can I do to solve this ? How can I replicate this for the 2nd sunday of November ?
You do not have the required permissions to view the files attached to this post.
void
Developer
Posts: 19903
Joined: Fri Oct 16, 2009 11:31 pm

Re: Everything not displaying correct 1st sunday of a month

Post by void »

Excel date values: 1.0 = one day
Everything date values: 864000000000 = one day

It's one of quirks with Everything formulas.

Please try:

column1:=FORMATFILETIME(DATE(YEAR($dm:),MONTH($dm:),1)+(8-(WEEKDAY(DATE(YEAR($dm:),MONTH($dm:),1)-840000000000)+1))*840000000000)




more information here.
void
Developer
Posts: 19903
Joined: Fri Oct 16, 2009 11:31 pm

Re: Everything not displaying correct 1st sunday of a month

Post by void »

Everything 1.5.0.1384a changes WEEKDAY() to match the return values from Excel.

DATE() now returns an Excel date serial number.

addcolumn:column1 column1:=DATE(YEAR($dm:),MONTH($dm:),1)-1+(8-(WEEKDAY(DATE(YEAR($dm:),MONTH($dm:),1)-1)) column1format:date