I have date stored as string in an sqlite database like "28/11/2010". I want to convert the string to date.
Specifically I have to convert lots of string dates between two dates.
In postgresql, I use to_date('30/11/2010','dd/MM/yyyy')
, how can I do the same thing with sqlite?
Something like this:
SELECT * FROM table
WHERE to_date(column,'dd/MM/yyyy')
BETWEEN to_date('01/11/2010','dd/MM/yyyy')
AND to_date('30/11/2010','dd/MM/yyyy')
As Sqlite doesn't have a date type you will need to do string comparison to achieve this. For that to work you need to reverse the order - eg from dd/MM/yyyy to yyyyMMdd, using something like
where substr(column,7)||substr(column,4,2)||substr(column,1,2)
between '20101101' and '20101130'