Is it possible to format a date using sqlite3?
3 answers
I believe sqlite3 does not have a DATE type, so you have to do it manually in your Python code. Either you store the date in this particular form, or convert it to a timestamp or other form.
Have a look at the datetime module and especially the function strptime
.
+1
a source to share
As stated in other answers, it is stored as a string. However, it will be recognized as a date if you paste it in one of the following formats
Time strings
The time string can be in any of the following formats:
1. YYYY-MM-DD
2. YYYY-MM-DD HH:MM
3. YYYY-MM-DD HH:MM:SS
4. YYYY-MM-DD HH:MM:SS.SSS
5. YYYY-MM-DDTHH:MM
6. YYYY-MM-DDTHH:MM:SS
7. YYYY-MM-DDTHH:MM:SS.SSS
8. HH:MM
9. HH:MM:SS
10. HH:MM:SS.SSS
11. now
12. DDDDDDDDDD
LINK:
Date and time functions
+1
a source to share