Search code examples
google-app-enginegqlgqlquery

How to query all entries from past 6 hours ( datetime) in GQL?


I have a simple table in Google App Engine with a date field. I want to query all the rows with the date field valued between now and 6 hours ago. How do I form this query?


Solution

  • SELECT * FROM simpletable
    WHERE datefield < DATETIME(year, month, day, hour, minute, second)
    

    computing those year, month, &c, in your application code.