问题
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!
回答1:
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")
来源:https://stackoverflow.com/questions/15697184/play-framework-pretty-print-date