0
votes

Is it possible to make a google datastore GQL query with a comparison on the current DateTime?

Example:

select * from MY_KIND where created_at < DATETIME.NOW

I've seen anything about that on any post or google documentation: https://cloud.google.com/datastore/docs/reference/gql_reference

I need to make an operation on data older than 30 days.

1
what query did you use to get data older than 30 days?Minesh Barot

1 Answers

0
votes

You can use an alternative approach by trying to fetch entries after a particular date.

SELECT * FROM Entry WHERE date > DATETIME(yyyy,mm,dd)

The right-hand side of a comparison can be one of the following:

  • A datetime, date, or time literal, with either numeric values or a string representation, in the following forms:

    DATETIME(year, month, day, hour, minute, second) DATETIME('YYYY-MM-DD HH:MM:SS') DATE(year, month, day) DATE('YYYY-MM-DD') TIME(hour, minute, second) TIME('HH:MM:SS')

Hope this answers your question!!