4

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.

Josh Petitt
  • 9,371
  • 12
  • 56
  • 104

1 Answers1

13

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.

Community
  • 1
  • 1
dmahapatro
  • 49,365
  • 7
  • 88
  • 117
  • Yes! Thank you so much! Can you tell me where you found this default format documented? I couldn't find it anywhere. I could find lots of info about formatting when sending to client from server, but not vice versus. – Josh Petitt Sep 27 '13 at 18:20
  • 2
    @JoshPetitt I was in the same boat few months back but dig through source code to find it out. Worth adding to the docs. – dmahapatro Sep 27 '13 at 20:30