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

I've been programming for 25 years or so.

Hmm dates... It's almost as if you'd want to just count the number of seconds/ms since some point in time. Then you can do arithmetic easily, don't have to worry about calendars, leap years, etc... :/

Converting a date to a human readable form is hard. There is no way on earth that computers should be storing dates in human calendar readable forms. They should only ever be converted to that format for display purposes. That is the lesson MS don't ever seem to learn.



Converting a date to a human readable form is hard.

No, converting a date to human readable form is the easy part.

The hard part is converting the number of seconds from some epoch into a date.

The number of seconds from some reference point is not the same as a date.


So if I want add a year to a date and time I just have to add the number of seconds in a year which sounds ludicrously easy I agree. I want to know the exact date and time one year from February the 29th at 12:00 hours 2012. I want the answer to be consistent so what is the date and how many seconds do I add? I would also like to know the exact date and time one year from February the 28th at 12:00 hours 2011. I want the answer to be consistent so what is the date and how many seconds do I add?


Right. Like when you want some maintenance task to run once per month; you can just ignore the calendar and do simple arithmetic.




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

Search: