4 ms·
>2020-08-06 I've just switched to 20200806. Let it be an int and be done with it.
by LatteLazy 6y ago
>2020-08-06
I've just switched to 20200806. Let it be an int and be done with it.
- owl57 6y agoHuman readability sometimes matters.
- stjohnswarts 6y agowhat human can't parse that? Sure it might take a half a second longer but it's hardly confusing.
- gmfawcett 6y agoFor those of us whose professional lives sometimes require staring at directory listings full of filenames like "output-200003021342"... for the love of God, please just put the dashes in. I have an infinite number of dashes, I'll send you a lifetime supply!
- thaumasiotes 6y agoThe integer 20200806 is chosen solely for the purpose of human readability. If you actually wanted to store a date as an integer, you'd use the Julian day.
- gmfawcett 6y agoA 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.
- JackFr 6y agoIt’s beautiful. Just mod 7 to find the day of the week.
- gmfawcett 6y agoExcellent 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.)
- trianglem 6y agoI don’t get this? What does 10100403 mean?
- apricot 6y agogreatideainthesameveinivedecidedtoforgospacesandpunctuationaswellbecauseitsavesspaceaswellaswearandtearonthekeyboard