Liferay输入日期格式 [英] Liferay input-date format
问题描述
我正在使用Liferay 6.2,并希望使用 liferay-ui:input-date 字段.现场本身工作正常.但是我想将显示的日期格式更改为
I am using Liferay 6.2 and want to use a liferay-ui:input-date field. Field itself is working fine. However i want to change the displayed date Format from
mm/dd/yyyy
到
dd.mm.yyyy
但是该怎么做呢?我看不到任何服装来设置这个...
But how to do this? I cant see any attibutes to set this...
<liferay-ui:input-date firstDayOfWeek="1"
yearValue="<%=calendar.get(calendar.YEAR)%>"
monthValue="<%=calendar.get(calendar.MONTH)%>"
dayValue="<%=calendar.get(calendar.DAY_OF_MONTH)%>" dayParam="dateFrom-day"
monthParam="dateFrom-month" yearParam="dateFrom-year" />
推荐答案
我查看了输入日期标签库代码,如果要更改模式,则必须修改其代码.文件的路径:\ webapps \ ROOT \ html \ taglib \ ui \ input_date \ page.jsp.您只需替换以下行即可:
I looked at the input-date taglib code and if you want to change the pattern you have to modify its code. Path to the file: \webapps\ROOT\html\taglib\ui\input_date\page.jsp. Simply you can replace this line:
Format format = FastDateFormatFactoryUtil.getSimpleDateFormat(simpleDateFormatPattern, locale);
具有:
Format format = FastDateFormatFactoryUtil.getSimpleDateFormat("dd.MM.yyyy", locale);
mask = "%d.%m.%Y";
Format format = FastDateFormatFactoryUtil.getSimpleDateFormat("dd.MM.yyyy", locale);
mask = "%d.%m.%Y";
并保存文件.更为优雅的解决方案是在此组件上创建一个钩子,但这取决于您.
and save the file. More elegant solution would be creating a hook on this component, but it's up to you.
这篇关于Liferay输入日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!