Hello,
I'm having a hard time manipulating Date objects in Groovy implementation ...
I basically want to get a timestamp of a month ago. For example I get a timestamp
"200611" for now, and I want to retrieve the "200610" string.
This is what I'm doing:
<%
timestamp = $xwiki.formatDate($xwiki.getCurrentDate(),"yyyyMM")
oldtime = $xwiki.getDate().getTime()-(1000*60*60*24*30)
def olddate = new java.util.Date(oldtime)
oldtimestamp = $xwiki.formatDate(olddate, "yyyyMM")
%>
olddate contains a modified date (maybe the computation is wrong but for now it's not
my problem). I get an error on last line, a NullPointerException occurring in the
formatDate method. But I logged that olddate is not null (it contains a Date), so I
don't really understand from where would come the NullPointerException ?????
Many thanks in advance,
Jérémie
Show replies by date