Nov 25, 2021 9:49 AM
Hi,
I've done a few searches, so forgive me if this has been answered before.
I managed to find the code below, which seems to be the reverse of what I need.
In my HubDB I have a column called date. I want all rows in the past to display, but all rows in the future not to. The code I am using below displays future posts but not past ones. Am I missing something simple?
{% set queryparam = "&date__gt=" + local_dt|unixtimestamp %}
Solved! Go to Solution.
Nov 25, 2021 11:48 AM - edited Nov 25, 2021 11:49 AM
Unixtime goes up from 00:00:00 UTC on 1 January 1970, so your query is looking for rows with a date greater than the local date time, as in, dates in the future. Change date__gt
(i.e. date is greater than) to date__lt
(date is less than).
{% set queryparam = "&date__lt=" + local_dt|unixtimestamp %}
Nov 25, 2021 11:48 AM - edited Nov 25, 2021 11:49 AM
Unixtime goes up from 00:00:00 UTC on 1 January 1970, so your query is looking for rows with a date greater than the local date time, as in, dates in the future. Change date__gt
(i.e. date is greater than) to date__lt
(date is less than).
{% set queryparam = "&date__lt=" + local_dt|unixtimestamp %}