Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
latexr
on March 1, 2024
|
parent
|
context
|
favorite
| on:
Ask HN: Did you encounter any leap year bugs today...
The rule is that leap years are the ones divisible by 4. Unless it’s also divisible by 100. Unless unless it’s divisible by 400.
So 2000 was leap, but 2100, 2200, and 2300 won’t be, but 2400 will be.
swores
on March 1, 2024
[–]
Ahh, so it's centuries that aren't divisible by 400 rather than that aren't divisible by 4, that makes more sense!
Thanks for answering
thaumasiotes
on March 1, 2024
|
parent
[–]
It's centuries that aren't divisible by 4. It isn't years that aren't divisible by 4.
Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
So 2000 was leap, but 2100, 2200, and 2300 won’t be, but 2400 will be.