Social Media

Format JodaTime in JSF

My Bean has a jodatime DateTime object –

private DateTime myDateTime;

And I need to format the date as a String in a JSF. The easiest way is to call the DateTime object’s toString method(note the single quotes) –

<h:outputText value=”#{myDateTime.toString(‘dd/MM/YYYY’)}” />

About the Author Martin Farrell

My name is Martin Farrell. I have almost 20 years Java experience. I specialize inthe Spring Framework and JEE. I’ve consulted to a range of businesses, and have provide Java and Spring mentoring and training. You can learn more at About or on my consultancy website Glendevon Software

follow me on:

Leave a Comment: