On Mon, Jan 6, 2014 at 2:16 PM, Stéphane LASSIRE <[email protected]> wrote:
> Hello,
>
> I put a new field in the user page to see the last login of each for
> statistics purposes.
> On november and december last year it rans perfectly.
>
> But on january, the month is only on 1 letter !
>
> The macro :
> {{velocity}}
>

> #set($date_ll = $datetool.getYear()+ '/' + $datetool.getMonth() + '/' +
> $datetool.getDay())

This is better and safer:

#set($date_ll = $datetool.get('yyyy/MM/dd'))

Hope this helps,
Marius

>
> #set($name = $xcontext.getLocalUser())
> #set($myDoc = $xwiki.getDocument($name))
> #set($obj = $myDoc.getObject('XWiki.XWikiUsers'))
> #set($discard = $obj.set("last_login", "$date_ll"))
> #set($discard = $myDoc.save())
>
> {{/velocity}}
>
> Result for today :
> "2014/0/6"
>
> Last month I got 2014/12/06 for example.
>
> is there some strange behaviour withe the getMonth() function ?
> thanks
>
> Cordialement
>
> Stéphane Lassire
> Chargé de l'informatique et de la communication
> Tél direct : 01 42 85 81 87
> Courriel : [email protected]
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to