Formatting dates in Grails

I have a domain class in Grails with a travelDate field. the trip name is specified like this: -

Travel dateDate

then in my .gsp list I am showing a date like this: -

$ {fieldValue (bean: travelInstance, field: 'tripDate')}

And displayed in the following format: -

2009-08-19 17: 12: 00.0

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

+2


source to share


2 answers


Have you looked at the date format tag ?



+5


source


Use

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

      



or

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

      

+4


source







All Articles