Take the 2-minute tour ×

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);


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

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

You're apparently displaying the toString() outcome of the Date object like as


The format is specified in the javadoc and it indeed includes the timezone.


public String toString()

Converts this Date object to a String of the form:

dow mon dd hh:mm:ss zzz yyyy

You need SimpleDateFormat#format() to convert the obtained Date object to a String in the desired format before representing it. For example,

String s = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(output);
System.out.println(s); // 01-01-2010 12:34:03
share|improve this answer
ah, I see. Thank you very much. –  Doug McComber Aug 3 '11 at 15:36
You're welcome. –  BalusC Aug 3 '11 at 15:36
add comment

When a Date object is created, the timezone is set from the system settings.

try output.getTimeZoneoffset() and it returns the offset in minutes (for ADT it's -180)

share|improve this answer
add comment

Your Answer


