Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

A beautiful property of using ints to represent dates is that you can manipulate them using simple arithmetic. For example, if you want to refer to noon-time on 20200806, you can simply divide the day in two and write it as 10100403. An elegant, DRY solution to a perennial problem.


I don’t get this? What does 10100403 mean?


The poster is gently teasing the idea that integers like 20200806 are a reasonable way to to represent dates. Dividing 20200806 by 2, we get 10100403, representing the half-way point of the day (noon-time). Of course it's nonsense.


I’ve been had


It’s beautiful. Just mod 7 to find the day of the week.


Excellent example. Honestly, I have no idea why the concept hasn't caught on yet.

(I'd love to discuss this further... I'll be back on HN later tonight, sometime around 16834005.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: