Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

play framework pretty print date

I've been googling for a while but I just can't seem to figure out how to pretty print a java date in a template

my application.conf contains

date.format="yyyy-MM-dd hh:mm:ss"

and this is what I'm trying in my template

${(event.date).format('dd MMMM yyyy')}

The event member looks like

@Required
public Date date;

Any help would be appreciated, cheers!

like image 298
Victor Parmar Avatar asked Dec 27 '22 06:12

Victor Parmar


1 Answers

You are using Play 1 formatting, which doesn't work in the Play 2 scala templates. You need to use the @ symbol in Play 2.

Try

 @event.date.format("dd MMMM yyyy")
like image 165
Codemwnci Avatar answered Jan 07 '23 20:01

Codemwnci