PerBonomi
9 years agoBoss
Get messages from certain date range
Hi there.
I'm getting start and end dates dynamically from the current url (so admins can choose their own dates):
?startDate=2016-01-01&endDate=2016-02-15 <#assign dateStart = http.request.parameters.name.get("startDate", "")?string /> <#assign dateEnd = http.request.parameters.name.get("endDate", "")?string />
Now I'm trying to use these dates to get messages within that range, but I can't seem to get it to work.
SELECT count(*) FROM messages WHERE author.id = '${user.id}' AND post_time > '${dateStart}' AND post_time < '${dateEnd}'
I've been reading about different (iso) formats, converting with certain ?string variables, but I just seem to be stuck. Freemarker and dates are my biggest weakness.
Help?