A JavaScript client sends some strings to my server, one of which comes in form of a JavaScript Date object’s string representation.
Now, this JavaScript Date object has its own formatting and I was just wondering if there is a class that does the right conversion, as I am experiencing problems with the SimpleDateFormatter.
This is how a JavaScript Date string looks like: Tue Feb 12 2013 21:12:28 GMT+0100 (CET)
Best way to serialize the date in javascript is to use
toUTCString(not justtoString());toUTCStringwill produce an rfc 822 date (in the same format as used by http). Then you can just use the following SimpleDateFormat pattern to parse it in java: