SQlite: Column format for unix timestamp; Integer types

Posted by SF. on Stack Overflow See other posts from Stack Overflow or by SF.
Published on 2010-04-06T09:28:28Z Indexed on 2010/04/06 9:33 UTC
Read the original article Hit count: 528

Original problem: What is the right column format for a unix timestamp?

The net is full of confusion: some posts claim SQLite has no unsigned types - either whatsoever, or with exception of the 64bit int type (but there are (counter-)examples that invoke UNSIGNED INTEGER). The data types page mentions it only in a bigint example. It also claims there is a 6-byte integer but doesn't give a name for it. Of course standard INTEGER being 4-byte signed signed stores unix timestamps as negative numbers. I've heard that some systems return 64-bit timestamps too. OTOH I'm not too fond of wasting 4 bytes to store 1 extra bit (top bit of timestamp), and even if I have to pick a bigger data format, I'd rather go for the 6-byte one. I've even seen a post that claims SQLite unix timestamp is of type REAL...

Complete problem: Could someone please clarify that mess?

© Stack Overflow or respective owner

Related posts about sqlite

Related posts about unix-timestamp