SQLite Forum

Best practice: Save partial dates
Login
Hello,

I have to save partial dates into a SQLite database. What is the best practice for that? In my case, I have no possibility to store the three values seperate.

* complete date: 2021-06-29
* year-month: 2021-06
* year: 2021
* only month: 06
* only day: 29

My oppoinion is, to use a TEXT-field and seperate with a dash (like iso-8601).

* complete date: 2021-06-29
* year-month: 2021-06-
* year: 2021--
* only month: -06-
* only day: --29

So I have to opportunity to split this string in my program and work with this values in my code.

Another important thing is, that I cannot use an integer. I have dates before 1970 and so I can use TEXT and REAL. So I think the TEXT ist the best option.

Does someone have a better idea? Thank you!