0

I have the following code:

Calendar cal= Calendar.getInstance();
cal.set(Calendar.YEAR, 1994);   
cal.set(Calendar.MONTH, 03);
cal.set(Calendar.DAY_OF_MONTH,1);
cal.set(Calendar.HOUR_OF_DAY, 0); 

After running it I expect:

cal.get(Calendar.HOUR_OF_DAY);

to return 0, but it returns 1.

If I use a different year/month, it works fine. Also, setting another hour works fine, it happens only for 0.

Is there something special about April 1994? What am I missing here?

Thanks in advance.

sgrossman
  • 105
  • 2
  • 7

1 Answers1

1

I was using Israel TZ and due to DST transition the hour 0 on April 1st '94 does not exist.

sgrossman
  • 105
  • 2
  • 7