I was able to work this way with @cms answer, and this is what worked for me.
SELECT *,(julianday(substr(rdate`,1`,4)||"-"||substr(rdate`,5`,2)||"-"||substr(rdate`,7`,2))-julianday(substr(tdate`,1`,4)||"-"||substr(tdate`,5`,2)||"-"||substr(tdate`,7`,2)))'difference' FROM table WHERE difference <= 30.0
He worked like a charm
source
share