Search code examples
dategoogle-sheetsgoogle-sheets-formulagoogle-sheets-querygoogle-query-language

Query with datetime check excludes some records


For some reason my query does not take these records into consideration:

50  19/09/2019 15:00:00
60  19/09/2019 17:00:00
70  19/09/2019 18:00:00

What is causing that? Everything seems to work fine otherwise. It excludes the record which is beyond 7 days ago.

Data


Solution

  • =QUERY(A:B, 
     "where B >= date     '"&TEXT(TODAY()-7, "yyyy-MM-dd")&"' 
        and B <= datetime '"&TEXT(NOW(),     "yyyy-MM-dd hh:mm:ss")&"'", 0)
    

    0