Show row before current date

Philip_Marsh
Contributor

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 %}

 

0 Upvotes
1 Reply 1
piersg
Key Advisor

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 %}