Looking for date x weeks ago.
Author: rbitdd
Publication Date: 8/26/2010 16:02
Hello community,
I have to get all entries within the last x weeks from my news-table.
The select is not that difficult, but how do I get the right entry.
<CMS_FUNCTION name="contentSelect" resultname="fr_cs_news">
<CMS_PARAM name="schema" value="schema-name" />
<QUERY entityType="news">
<GTE attribute="date" datatype="java.util.Date" value="1281006562000"/>
</QUERY>
</CMS_FUNCTION>
Any ideas? Is it some how possible?
Thanks in advance.
Tags: berechnen, calculate, calendar, database, date, datenbank, datenquelle, query
-
Author: Peter_Jodeleit - 8/27/2010 7:20
"day_of_week" is definitely wrong, this is the week day (monday, tuesday, etc.)!
I would recommend #startdate + (-7 * 24 * 60 * 60 * 1000):
<CMS_FUNCTION name="contentSelect" resultname="thisWeek">
<CMS_PARAM name="schema" value="schema-name" />
<CMS_VALUE_PARAM name="d" value="#startdate + (-7 * 24 * 60 * 60 * 1000)"/>
<QUERY entityType="news">
<FILTERPARAM parameter="von" datatype="java.util.Date" value="0"/>
<AND>
<GTE attribute="date" parameter="d"/>
</AND>
<ORDERCRITERIA attribute="date" descending="0" />
</QUERY>
</CMS_FUNCTION>0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
1 commentaire