Joda Time Plugin

The Joda Time plugin provides a Velocity-friendly API on top of the Joda Time library. The plugin is enabled by default in XWiki Standard, so you will find it in the "xwiki.plugins" list of the xwiki.cfg file:

#-# List of active plugins.

The source code is available on GitHub at xwiki-platform-jodatime.



## Format the displayed result
#set($formatter = $xwiki.jodatime.getDateTimeFormatterForStyle('F-'))

## Display the current time
#set($currentTime = $xwiki.jodatime.dateTime)

## Display the second day of the current week
#set($secondDayWeek = $currentTime.withDayOfWeek(2))


will display


Example using "getDateTimeFormatterForPattern"


#set($formatter = $xwiki.jodatime.getDateTimeFormatterForPattern("dd/MM/yyyy 'at' hh:mm"))

## Display the document creation time
#set($creationDate = $xwiki.jodatime.getDateTime($doc.creationDate.time))
Document created on $formatter.print($creationDate)

## Display the number of days left until Easter
#set($formatter = $xwiki.jodatime.getDateTimeFormatterForPattern('yyyy.MM.dd'))
#set($easterDay = $formatter.parseDateTime('2014.04.20'))
#set($now = $xwiki.jodatime.dateTime)
#set($daysLeft = $easterDay.minus($now.millis))
$daysLeft.getDayOfYear() days left until Easter


will display 


More examples for the Joda Time plugin are available on

Related Pages

Search this space


Most popular tags

Failed to execute the [groovy] macro
  1. access rights
  2. activity stream
  3. annotation
  4. attachment
  5. comment
  6. Document Tree Macro
  7. export
  8. Extension Manager
  9. Flamingo skin
  10. global user
  11. Groovy event listener
  12. group
  13. nested page
  14. search
  15. skin
  16. syntax
  17. user
  18. user profile
  19. velocity macros
  20. wiki
  21. wysiwyg
  22. XWiki Applications
  23. xwikiattachment_archive table
  24. xwikiattachment table
  25. xwikiattrecyclebin table
  26. xwikiproperties table

[Display all tags from this space]