CMS Development

Philip_Marsh
Colaborador

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 Me gusta
1 Soluciones aceptada
piersg
Solución
Asesor destacado

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

 

 

 

 

Ver la solución en mensaje original publicado

1 Respuesta 1
piersg
Solución
Asesor destacado

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