CMS Development

Philip_Marsh
Colaborador(a)

Show row before current date

resolver

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 Avaliação positiva
1 Solução aceita
piersg
Solução
Conselheiro(a) de destaque

Show row before current date

resolver

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

 

 

 

 

Exibir solução no post original

1 Resposta 1
piersg
Solução
Conselheiro(a) de destaque

Show row before current date

resolver

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