I checked this example and your script - it is not correct, because you compare separately year, month and day of document with current date - year, month and day-100. But if, for example now is 02 january, your script give uncorrect result, becase I also should change year and month (and year), then I want to get date BEFORE 100 days of 02 january.
Need to make arithmetical operations with dates and these operations should consider also possible transitions of month and year when day changed ... In any case - thanks! I found the answer - need to use special velocity object $datetool Example: #set ($d = 5) - days interval which I need #set ($ms = $d * 24 * 60 * 60 * 1000) - Calculating internal in Milliseconds #set ($calendar = $datetool.getCalendar()) #set ($currentTime = $calendar.getTimeInMillis()) #set ($targetTime = $currentTime - $ms) #set ($void = $calendar.setTimeInMillis($targetTime)) #set ($targetDate = $calendar.getTime()) #set ($targetYear = $datetool.getYear($targetDate)) :get year of a date = currentdate - 5 days #set ($targetMonth = $datetool.getMonth($targetDate) + 1) :get month of a date = currentdate - 5 days #set ($targetDay = $datetool.getDay($targetDate)) :get day of a date = currentdate - 5 days and after this, in a hql searching, I can compare this year, month, and day with documents year, month and day ... -- View this message in context: http://xwiki.475771.n2.nabble.com/using-XWQL-with-additional-search-criterias-by-dates-tp5660503p5666357.html Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
