问题
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