rocks
rocks

Reputation:

formatting dates in Grails

I have a domain class in Grails with a field journeyDate. journeyDate is defined like this:-

Date journeyDate

then in my list.gsp I display the date like this:-

${fieldValue(bean:journeyInstance, field:'journeyDate')}

And it is displayed in the following format:-

2009-08-19 17:12:00.0

does anyone know how I can format this on the list.gsp so that it doesn't display the seconds? (I don't want to change the way it is stored in the database)

Upvotes: 2

Views: 7914

Answers (2)

Amit Jain
Amit Jain

Reputation: 1382

Use

${fieldValue(bean:journeyInstance, field:'journeyDate').format("dd MM, yyyy")}

or

${journeyInstance.journeyDate.format('dd MM, yyyy')}

Upvotes: 4

Langali
Langali

Reputation: 3207

Have you looked at the date format tag?

Upvotes: 5

Related Questions