GORM default Date format when sending date to Grails

橙三吉。 提交于 2020-01-01 12:34:07

问题


I am sending a JSON PUT request to Grails. In the JSON object, I have a date string. I have searched and experimented, but I cannot determine the default date string format that GORM wants to parse the date string. In all my attempts I get the following error:

java.lang.IllegalArgumentException: Could not parse date: Unparseable date

I just want to know the default format GORM expects and I will happily format the date string in that format before sending it to the server.


回答1:


I suppose you face this issue during data binding.

Reason:
Default date format for binding is yyyy-MM-dd HH:mm:ss.S

Solution:
The default data format can be changed using PropertyEditorRegistrar. Follow this for details.



来源:https://stackoverflow.com/questions/19057317/gorm-default-date-format-when-sending-date-to-grails

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!