(41CX/DM41)(17Bii) Date of the first Advent Sunday in a year
|
01-24-2021, 05:00 AM
Post: #5
|
|||
|
|||
RE: (41CX/DM41)(17Bii) Date of the first Advent Sunday in a year
(08-10-2020 03:02 PM)ggauny@live.fr Wrote: Instead of DDays I'm using DOW, but unfortunatly DOW gives 0 if the day is a sunday, (HP Prime gives 7). No need to adjust, just shift the reference to Christmas Eve. Better yet, reference to Dec 3, eliminated the need to subtract 21 days. 1st Advent Sunday = (Dec 3) - DOW(Dec 3) days // Nov 27 to Dec 3 Code below assumed date format MM.DDYYYY Code: 00 { 29-Byte Prgm } Since DOW(Dec 3) = DOW(Dec 31), we can even do this in the head, using facts below: 1. Gregorian calendar repeat itself every 400 years. 2. DOW(Dec 31, 2000) = 0 (Sunday) 3. 365 days = 52 weeks + 1 day Example, Year 2016: 2016 % 400 = 16 leap years count = IP(16/4) - IP(16/100) = 4 DOW(Dec 31, 2016) = (4 + 16) % 7 = 6 (Dec 3, 2016) - 6 days = Nov 27, 2016 Example, Year 2021: 2021 % 400 = 21 leap years count = IP(21/4) - IP(21/100) = 5 DOW(Dec 31, 2021) = (5 + 21) % 7 = 5 (Dec 3, 2021) - 5 days = Nov 28, 2021 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(41CX/DM41)(17Bii) Date of the first Advent Sunday in a year - jthole - 02-04-2020, 10:34 PM
RE: (41CX/DM41)(17Bii) Date of the first Advent Sunday in a year - ggauny@live.fr - 08-10-2020, 03:02 PM
RE: (41CX/DM41)(17Bii) Date of the first Advent Sunday in a year - Wolfgang - 01-22-2021, 01:27 PM
RE: (41CX/DM41)(17Bii) Date of the first Advent Sunday in a year - Albert Chan - 01-24-2021 05:00 AM
RE: (41CX/DM41)(17Bii) Date of the first Advent Sunday in a year - Werner - 08-11-2020, 08:03 AM
RE: (41CX/DM41)(17Bii) Date of the first Advent Sunday in a year - ggauny@live.fr - 01-24-2021, 10:35 AM
|
User(s) browsing this thread: 1 Guest(s)