播放框架漂亮的打印日期 [英] play framework pretty print date

查看:94
本文介绍了播放框架漂亮的打印日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索了一段时间,但似乎无法弄清楚如何在模板中打印Java日期

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

我的application.conf包含

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

这就是我要在模板中尝试的内容

and this is what I'm trying in my template

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

事件成员的样子

@Required
public Date date;

任何帮助,不胜感激!

推荐答案

您正在使用Play 1格式,但在Play 2 scala模板中无法使用.您需要在Play 2中使用@符号.

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.

尝试

 @event.date.format("dd MMMM yyyy")

这篇关于播放框架漂亮的打印日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆