Thank you very much! Now I have one more question - is it possible to do
something similar, but in situation, when validDate doesn't contain a date,
but a name of a column, which contains the date?
Example:
FROM doc.object('$xcontext.macro.params.parentSpaceClass') AS page WHERE :
validDate >= $currDate ORDER BY $ordCol
$xcontext.macro.params.orderDirection
validDate - page.enddate
---------- Původní zpráva ----------
Od: Marius Dumitru Florea <mariusdumitru.florea(a)xwiki.com>
Komu: XWiki Developers <devs(a)xwiki.org>
Datum: 6. 11. 2014 10:29:38
Předmět: Re: [xwiki-devs] Compare different format dates in an XWQL query
"On Thu, Nov 6, 2014 at 11:19 AM, vincent(a)massol.net <vincent(a)massol.net>
wrote:
On 6 Nov 2014 at 10:16:00, Katsushiro (martinbeseda(a)seznam.cz(mailto:
martinbeseda(a)seznam.cz)) wrote:
Hello!
Is there any way to compare two dates formatted differently in one XWQL
query? Here is my query:
/FROM doc.object('$xcontext.macro.params.parentSpaceClass') AS page WHERE
:validDate >= $currDate ORDER BY $ordCol
$xcontext.macro.params.orderDirection/
validDate - variable, which contains date formatted like this (page
content): /01/10/2014 14:47:08/
$currDate - variable, which contains date formatted like this (from XWili
$xwiki.getDate()): /Thu Nov 06 11:09:40 EET 2014/
If there is some way I can do this, please, answer me, I'll be incredibly
thankful for it. If there isn't, I'll filter gained data with Velocity.
Yes please see the examples at
http://extensions.xwiki.org/xwiki/bin/view/
Extension/Query+Module
Fo ex:
$services.query.xwql("where doc.creationDate >
:date").bindValue('date', $
datetool.toDate('yyyy-MM-dd',
'2008-01-01')).execute()
In other words:
* always use parameters in where clause, even for $currDate
* don't pass string value for date parameters; pass either a Date
object or a long (timestamp). You can obtain the Date object from your
string using $datetool as shown above
Hope this helps,
Marius
Thanks
-Vincent
Thank you for all your answers, Katsu
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs"