Rails allows calling `to_s` with an optional format argument on dates. This can lead to cryptic "wrong number of args" errors when you end up calling something like `http://nil.to _s(:db)` Using the alias `to_formatted_s(:db)` leads to a much nicer "no method error"
Creating your own epoch is pretty common. PG stores time as a 64 bit integer representing microseconds since 01-01-2000 (also I was mistaken in my other tweet, OSX is since 2001)
-
-
If you're creating your own time format, epoch + counter is the most sane way to do it. Much nicer than trying to do some kind of human-readable thing.
-
I worked on a project once that represented time-of-day as a 4-digit number. 0000 was null and 2400 was midnight. It allowed all sorts of invalid values like 1075 or 3000. Doing any kind of math, even just generating a human-formatted string was really painful

- 2 more replies
New conversation -
-
-
If you aren't specifically storing a 32 bit integer as seconds, there's not much reason to use 1970-01-01 as your 0 point, it's pretty arbitrary either way
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.