Different date format in Rest WS response in java

I have two SOAP and Rest webservices both has a field called CreatedDate. I am getting date from the DB and setting to the Date field of Java class. There are two different Output object for each service. But when I access these services from the SOAP UI, I am getting different format of time.

From SOAP: 2014-06-02T03:05:34-05:00
From Rest: 2014-06-02T08:05:34Z

Both are same time coming from same DB cell. But format is different. I am using CXF for both WS with spring. I want both in first format.

Thanks

Jon Skeet
people
quotationmark

But format is different.

Not really. They're both using the date/time format in RFC 3339 / ISO-8601, as per the W3C XML schema recommendation, which expresses an offset from UTC as well as the local date/time. Z is used as a UTC offset of 0.

Those are different values in terms of the time zone offset, but represent the same instant in time. One representation expresses this in UTC, another in a time zone which is 5 hours behind UTC at that instant. (Contrary to the terminology used in various standards, the "-05:00" doesn't actually identify a time zone; it only shows the offset from UTC at that instant. A "real" time zone is effectively a function from any UTC instant to the local time at that instant.)

people

See more on this question at Stackoverflow