I have a column of datetime type from which I would like to retrieve only the date. Is there anyway to do this?
Previously it was an epoch value where I convert it t
This works.
SELECT strftime('%d', '2011-04-26')
You can get year, month, day and everything else that is a part of date.
But you must be carefull how you enter those strings.
The format of date is YYYY-MM-DD
, so you must enter the string in that format.
It's also case-sensitive. If you want a month, then you should use %m
, because if you use %M
, it will try to get a minutes, and if you don't have time part in your date, it will throw an error.
For additional information check SQLite official site.