4 ms·
This page answers a question I was thinking about in the shower this morning: what is the latest date (as a UNIX timestamp) you can store in a regular postgres
by jonstokes 9y ago
This page answers a question I was thinking about in the shower this morning: what is the latest date (as a UNIX timestamp) you can store in a regular postgres integer column, which has a max value of 2147483647 per the postgres docs. It turns out that the answer is January 19 2038 03:14:07 GMT.
I'm working on a project that involves sync, and we're keeping track of action numbers by incrementing the last action number, but for various reasons I was thinking, "what if we replaced the action_number field with the corresponding timestamp integer?"
Then I began to ponder which integer format to use -- if I could get a way with just postgres integer, or if I needed to stop up to bigint. It turns out I should probably step up to bigint if I do this :-)
Anyway, I could've just done this in ruby, but by the time I saw this I had forgotten I was thinking about it, and this reminded me.
- NoNotTheDuo 9y agoYou've inadvertently discovered the "2038 Problem"[0]. This is the next iteration of the Y2K bug. [0]: https://en.wikipedia.org/wiki/Year_2038_problem https://en.wikipedia.org/wiki/Year_2038_problem
- jonstokes 9y agoWell well... TIL If I thought we'd all still be here in 2038 I'd have something new to worry about :-/
- jlgaddis 9y agocf. Year 2038 Problem [0] [0]: https://en.wikipedia.org/wiki/Year_2038_problem https://en.wikipedia.org/wiki/Year_2038_problem