簡體   English   中英

如何只顯示日期的素數日歷中的日期“ dd / mm / yyy” <p:inplace/>

[英]How to display only date “dd/MM/yyy” in primefaces calendar incide of <p:inplace/>

我試圖在此代碼中僅顯示日期,月份和年份,但是當我放置初始日期並單擊就位保存按鈕時,該日期將顯示為:“ 2014年8月21日星期四00:00:00”只希望顯示為:“ 21/08/2014”或“ 21 / Aug / 2014”

這是代碼:

<p:outputLabel value="#{msg['startDate']}" for="inputInitialDate"/>
<p:inplace id="inputInitialDate" editor="true" emptyLabel="#{msg['period.addInitialDate']}" 
                               disabled="#{periodManager.currentPeriod.state == 'DUE'}">
    <p:ajax event="save" listener="#{periodManager.addDateToPeriod}" update="formContainer"/>
    <p:calendar value="#{periodManager.currentPeriod.initialDate}" pattern="dd/MM/yyyy"
                                    widgetVar="calendarInputWidget"/>
</p:inplace>
<p:message for="inputInitialDate"/>

<f:convertDateTime>添加到日歷中,重復pattern 實際上, <p:calendar>自己的pattern屬性經常被誤解。 它僅適用於應該在日歷選擇彈出窗口中顯示的模式,而不適用於輸出的模式。

<p:calendar ... pattern="dd/MM/yyyy">
    <f:convertDateTime pattern="dd/MM/yyyy" />
</p:calendar>

或者,再干一點。

<p:calendar ... pattern="dd/MM/yyyy">
    <f:convertDateTime pattern="#{component.pattern}" />
</p:calendar>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM