Java TimeZone instance shows different offsets when run on different environments

65 views Asked by At

My very simple code:

  public static void main(String[] args)
  {
    TimeZone tz = TimeZone.getTimeZone("Europe/Moscow");
    System.out.println(tz);
  }

When i run it locally on my machine i get:

sun.util.calendar.ZoneInfo[id="Europe/Moscow",offset=10800000,dstSavings=0,useDaylight=false,transitions=79,lastRule=null]

When deployed on a unix testing machine i get:

sun.util.calendar.ZoneInfo[id="Europe/Moscow",offset=14400000,dstSavings=0,useDaylight=false,transitions=78,lastRule=null]

So different offsets, it seems like the former is using day light saving time and the latter not, but the useDaylight field is in both set to false. what is suspicious is the amount of transitions, which on my local machine shows that it has gone through an additional transition compared to the test machine. Any idea?

1

There are 1 answers

0
Dmitry Gorkovets On

You might use different Java builds. One of them supports DST, another one is not. In Russia there is no DST changing anymore, maybe one Java build is old and does not know about it.