I parse a date that comes with time zone information, say: 1/7/2008 11:00:00 AM -0700
. The -0700
corresponds to the current time offset here in California, since we are now in PDT. If I parse it and show it with:
org.joda.time.format.DateTimeFormat.forPattern("M/d/yyyy hh:mm:ss a Z")
.parseDateTime("1/7/2008 11:00:00 AM -0700").toString()
I get: 2008-01-07T10:00:00.000-08:00
. This is "correct", as 10am -0800
= 11 am -0700
, but how can I get the returned date to keep the same time offset (the Z
part) I had in the input?
As a side note, using java.text.SimpleDateFormat
give a similar result: new SimpleDateFormat("M/d/yyyy hh:mm:ss a Z").parse("1/7/2008 11:00:00 AM -0700").toString()
returns Mon Jan 07 10:00:00 PST 2008
, and PST = -0800, while we are now in PDT.