Comparison dates with dd-mm-yyyy string format in sqlite

I save my dates as a string in the format 'dd-mm-yyyy'. Now I want to do the following:

SELECT strftime('%d/%m/%Y', myDate) as myDate
FROM myTable
WHERE myDate>='01/07/2013' and myDate<='24/07/2013'

But I get nothing. What is wrong with this request ?.

THIS IS NOT DETECTED DUPLICATE QUESTION. I wrote everything as a String, not DATE or DATETIME. I tried to compare strings with date format. So this is unfair.

+1
source share
2 answers

It is impossible for your request to work as with your current setting:

I save the date as a String, so I suppose using strftime I can get what I want. Or am I wrong?

Basically: you are mistaken!

, , , , .

:

myDate>='01/07/2013' and myDate<='24/07/2013'

, 24- , . . : "01.02.1900", : "02/12/2099".

, -, ( ). "02" , "01" "24", .

"" - , .. : "yyyy/mm/dd", , - , .

- , - . p >

, , :

where (substr(myDate, 7, 4) || '-' || substr(myDate, 4, 2) || '-' || substr(myDate, 1, 2)) between '2013-07-01' and '2013-07-24'

, , . .

+7

:

SELECT strftime('%d/%m/%Y', myDate) as myDate
FROM myTable
WHERE myDate between date('01/07/2013') and date('24/07/2013');
0

Source: https://habr.com/ru/post/1605757/


All Articles