Given the following:
String dt = "Wed Jan 1 12:34:03 2010";
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy");
Date output = sdf.parse(dt);
Produces:
Wed Jan 1 12:34:03 ADT 2010
Where is the timezone coming from? I don’t have z in my format pattern.
Thanks,
Doug
You’re apparently displaying the
toString()outcome of theDateobject like asThe format is specified in the javadoc and it indeed includes the timezone.
You need
SimpleDateFormat#format()to convert the obtainedDateobject to aStringin the desired format before representing it. For example,