Skip to content

JS millisecond dates and SQLite second dates, best practices? #1129

Closed Answered by mceachen
woodrna asked this question in Q&A
Discussion options

You must be logged in to vote

I totally get it.

I was super surprised to find (several years ago, but after using it for a decade) that SQLite doesn't support date or time column types at all: there are only a handful of date/time functions and those pretty much all revolve around ISO-esque strings.

I've resolved to storing millisecond timestamps for trusted times, and using something else when the timezone isn't necessarily correct.

You could adopt a naming scheme that appends "_ms" as a suffix for milliseconds-since-common-epoch values, if you think that helps system clarity.

If this sort of thing bugs you, you might be interested in knowing that SQLite is extremely lax by default. You need to specifically enable st…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by woodrna
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants