简体   繁体   中英

Output only the date component of a date + time in Grails

In grails, If I use dateCreated() instance in domain class then it returns date + time stamp. If I have to remove time stamp and retrieve only date on view page then is there any method to perform such task without modifying in domain class And also I have grid in my view page in which its showing date+time stamp so I also want to remove time stamp.

You can just format that date to show what you want. Docs

<g:formatDate format="yyyy-MM-dd" date="${date}"/>

使用formatDate标记

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM