Dims
Dims

Reputation: 51219

Java bug: incorrect time in MSK

I found that Java gives incorrect time in MSK timezone, ignoring operating system data:

enter image description here

As you see, the Java time is hour ahead.

The code is follows:

package tests;

import java.util.Date;

public class Try_CurrentTime {

    public static void main(String[] args) {

        System.out.println(new Date());

    }
}

java version is 1.8.0_25

We have no DST.

Is it possible to fix?

UPDATE

It doesn't think we have DST, because TimeZone.getDefault().inDaylightTime( new Date() ) returns false.

Upvotes: 0

Views: 132

Answers (1)

Matt Johnson-Pint
Matt Johnson-Pint

Reputation: 241778

Refer to the Timezone Data Versions in the JRE Software chart. The change you are referring to was made in tzdata 2014f - which was first introduced in TZUpdater 1.4.6, or JRE 1.8 update 31. You said you are running 1.8 update 25.

Simply update your Java runtime to the current version.

Upvotes: 2

Related Questions