Why I get wrong time / date for New York for the year 1966 and before, when I use EST5EDT timezone

Solution In Progress - Updated -

Issue

When /etc/local time is set to "EST5EDT", the java application getting incorrect time/date if the date is before 1966. if /etc/local set to "US/Eastern" or "America/New_York", the application time/date would be correct.
I use following sample code to test:

        System.out.println("Default Timezone " + TimeZone.getDefault());
        Calendar c = Calendar.getInstance(tz);

        c.set(1940, 4, 13);
        // c.set(1966, 9, 30);
        // c.set(1966, 9, 31);

        SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
        System.out.println("Time " + sdf.format(c.getTime()));

And the output is:

Default Timezone sun.util.calendar.ZoneInfo[id="EST5EDT",offset=-18000000,dstSavings=3600000,useDaylight=true,transitions=149,lastRule=java.util.SimpleTimeZone[id=EST5EDT,offset=-18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]

1940-05-12
1966-10-29
1966-10-31

Also run following tests:

[root@xxx tmp]# export TZ="US/Eastern"
[root@xxx tmp]# date --date='1003 months ago'
Sat May 17 12:46:25 EDT 1930
[root@xxx tmp]# export TZ="America/New_York"
[root@xxx tmp]# date --date='1003 months ago'
Sat May 17 12:46:37 EDT 1930
[root@xxx tmp]# export TZ="EST5EDT"
[root@xxx tmp]# date --date='1003 months ago'
Sat May 17 11:46:51 EST 1930

Environment

  • Red Hat Enterprise Linux
    • 6.2
  • Java(TM) SE Runtime Environment
    • build 1.6.0_45-b06

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content