Forum Discussion

clemensw's avatar
6 years ago

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...
  • Payal's avatar
    6 years ago

    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!