Alaattin KAYRAK
Alaattin KAYRAK

Reputation: 1124

Java gives wrong time zone

Java gives wrong timezone as output on my Android device.

TimeZone tz = TimeZone.getDefault(); 
System.out.println(tz.getDisplayName(false, TimeZone.SHORT));

Output:

EET

But it should be

EEST

It is EEST (GMT+03:00, Istanbul) in the Date&Time settings on the device.

Upvotes: 0

Views: 361

Answers (1)

laalto
laalto

Reputation: 152787

The first argument to getDisplayName() is:

daylightTime true for daylight time, false for standard time.

Given false, you'll get EET (UTC+2) for a device in EEST (UTC+3).

Upvotes: 1

Related Questions