Hi David
If you use CXF JSONProvider then JAXB will deal with reporting the value
of a given Date field, if Jackson - then Jackson does it.
If it is JAXB - consider trying a type adapter to control it
Cheers, Sergey
On 16/08/16 18:00, KARR, DAVID wrote:
I'm not sure where the problem for this lies, but I'm having a confusing issue
with the out of the box JSON rendering of Date values, with respect to
timezones.
For instance, a datetime value I'm getting from the DB is "2016-08-16 00:24:07.495".
This unfortunately doesn't have a timezone value, but it can be assumed to be in the PST timezone.
When I run my service on my Windows laptop, which is in the PST timezone (-7:00), the Date field
that gets this value gets rendered in JSON as "2016-08-16T00:24:07.495-07:00". This is
good, as far as I can tell. This value is read my javascript running in my browser and displays it
properly according to my local timezone (about 24 minutes after midnight early this morning).
When I run the same code on a Linux VM (which reports the same time and timezone as the
laptop) running off of the laptop, even though the database query gets the same value
back, the JSON coming from CXF renders as "2016-08-16T00:24:07.495Z". This
translates to my local timezone in javascript as 7 hours before that time, being the
middle of the afternoon on the previous day, which is wrong.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/