2015-01-02 16 views
0

我已經嘗試通過更改i18n中的日期格式屬性來格式化日期,並嘗試在我的控制器中格式化它,但無法獲取任何內容。我只需要它在這一個地方格式化。任何幫助表示讚賞。輸入字段中的Grails格式日期

<div class="col-sm-12"> 
    <input type="text" class="form-control" placeholder="Estimated EIU graduation date" name="eiuGradDate" id="eiuGradDate" value="${studentInfo.estimatedGradDate}"> 
</div> 

編輯 我有下面的類一個Groovy String對象:類org.codehaus.groovy.runtime.GStringImpl,我需要知道如何將其轉換爲DATE或一個普通字符串。

+0

提供'estimatedGradDate'是一個實際的'Date'類,你可以做'value =「$ {studentInfo.estimatedGradDate.format('MM/dd/yyyy')}」' –

+0

它的類顯示爲這樣,class org.codehaus.groovy.runtime.GStringImpl,我不知道那是什麼? –

+0

這是一個Groovy字符串。 –

回答

0

你可以使用taglibs來做任何你想要的東西白衣這個「價值」,在你的情況下,解析一些字符串到日期。

下面是一些文檔:

TagLib Doc

Usage

問候。