Tested with sqlite3 to prove that solution works without special SQL operators like DATEDIFF