5 ms·
For those wondering: it should be 86400 instead. 606024 = seconds in a day.
by weddpros 12y ago
For those wondering: it should be 86400 instead. 606024 = seconds in a day.
- ColinWright 12y agoYou have fallen foul of the HN formatting codes - you mean 60 * 60 * 24 seconds in a day. Or use the coding format: Seconds_in_a_day = 24 * 60 * 60 Of course, this is wrong anyway for any number of reasons, but it was the original intent.
- oneeyedpigeon 12y agoCare to provide some of those reasons?
- djent 12y agoLeap seconds, time zone changes, etc.
- ColinWright 12y agoAsking Google: https://www.google.co.uk/search?q=why+are+there+not+always+86400+seconds+in+a+day https://www.google.co.uk/search?q=why+are+there+not+always+8... Here's some reading: http://stackoverflow.com/questions/7552104/is-a-day-always-86-400-epoch-seconds-long http://stackoverflow.com/questions/7552104/is-a-day-always-8... http://stackoverflow.com/questions/12516059/php-timestamp-interval-between-days-not-always-86400-seconds-why http://stackoverflow.com/questions/12516059/php-timestamp-in... http://en.wikipedia.org/wiki/Day http://en.wikipedia.org/wiki/Day http://justinsomnia.org/2007/03/yesterday-was-only-82800-seconds-long/ http://justinsomnia.org/2007/03/yesterday-was-only-82800-sec...
- oneeyedpigeon 12y agoOK, but most of the time you're not really going to care about those exceptions, are you? Like in the example of setting a cookie for 'a day'.
- ColinWright 12y agoWhere you're using "day" to mean "reasonably long time in the context of browser session" then no, it won't matter. But if you're using time stamps as IDs in a database, recognize that the same time can occur twice as the clocks get put back in the fall, recognize that the "seconds" field can sometimes be more than 60, and so on. If you get into the habit of taking these shortcuts then you are likely to get caught out if you move outside the specific domain, and you ill be cursed as you introduce subtle and hard-to-find bugs based on invalid assumptions. Getting time-of-day issues right is hard.
- weddpros 12y agothanks :)