clemensw
6 years agoGuide
LiQL: messages from last 2weeks with floating timeframe
Hi,
how can we query messages with post_time within last 2 weeks? The 2 weeks should be calcutlated from the current (today) date. So it should be floating time frame
currently we have only a fixed timeframe
SELECT * FROM messages post_time > 2019-01-01T00:00:00.000+02:00
Thank you, best
clemensw
clemensw - Please try below code:
<#assign today = .now?long /> <#assign minus14days= today - (14 * 24 * 60 * 60 * 1000) /> <#assign since14days= minus14days?number_to_datetime?iso('GMT-08:00') /> <#assign post = "SELECT * FROM messages WHERE post_time > ${since14days}" />
Thanks!