You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by "Dag H. Wanvik" <Da...@Sun.COM> on 2008/11/01 03:00:26 UTC

Re: Date 2042-10-12 problem using Brasilia time zone

Thomas Mueller <th...@gmail.com> writes:

I got the same result on my box, 

1.6.0_10-beta-b24
SunOS
:

Dag


> Hi,
>
> I just made a simple test case. Could you please run that and post the result?
>
> import java.sql.Date;
> import java.util.TimeZone;
> public class DateProblem {
>     public static void main(String[] a) {
>         System.out.println(System.getProperty("java.runtime.version"));
>         System.out.println(System.getProperty("os.name"));
>         String[] ids = TimeZone.getAvailableIDs();
>         for (int i = 0; i < ids.length; i++) {
>             TimeZone.setDefault(TimeZone.getTimeZone(ids[i]));
>             for (int y = 2037; y < 2039; y++) {
>                 for (int m = 101; m < 113; m++) {
>                     for (int d = 101; d < 129; d++) {
>                         test(y, m, d);
>                     }
>                 }
>             }
>         }
>     }
>     static void test(int y, int m, int d) {
>         String s = y + "-" + ("" + m).substring(1) + "-" + ("" +
> d).substring(1);
>         String s2 = Date.valueOf(s).toString();
>         if (!s.equals(s2)) {
>             String e = "java.sql.Date.valueOf(\"" + s + "\"): \"" + s2 + "\"";
>             e += " TimeZone: " + TimeZone.getDefault().getID();
>             System.out.println(e);
>         }
>     }
> }
>
> I get:
> 1.6.0_05-b13
> Windows XP
> java.sql.Date.valueOf("2038-03-14"): "2038-03-13" TimeZone: America/Havana
> java.sql.Date.valueOf("2038-03-14"): "2038-03-13" TimeZone: Cuba
> java.sql.Date.valueOf("2038-10-17"): "2038-10-16" TimeZone: America/Asuncion
> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: America/Campo_Grande
> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: America/Cuiaba
> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: America/Santiago
> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: Antarctica/Palmer
> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: Chile/Continental
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: AGT
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> America/Argentina/Buenos_Aires
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> America/Argentina/Catamarca
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> America/Argentina/ComodRivadavia
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> America/Argentina/Cordoba
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> America/Argentina/Jujuy
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> America/Argentina/La_Rioja
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> America/Argentina/Mendoza
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> America/Argentina/Rio_Gallegos
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> America/Argentina/San_Juan
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> America/Argentina/Tucuman
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> America/Argentina/Ushuaia
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Buenos_Aires
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Catamarca
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Cordoba
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Jujuy
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Mendoza
> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Rosario
> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: America/Sao_Paulo
> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: BET
> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: Brazil/East
> java.sql.Date.valueOf("2038-03-28"): "2038-03-27" TimeZone: America/Scoresbysund
> java.sql.Date.valueOf("2038-03-28"): "2038-03-27" TimeZone: Atlantic/Azores
> java.sql.Date.valueOf("2038-03-25"): "2038-03-24" TimeZone: Asia/Amman
> java.sql.Date.valueOf("2038-03-28"): "2038-03-27" TimeZone: Asia/Beirut
> java.sql.Date.valueOf("2038-03-26"): "2038-03-25" TimeZone: Asia/Damascus
> java.sql.Date.valueOf("2038-04-01"): "2038-03-31" TimeZone: Asia/Gaza
> java.sql.Date.valueOf("2038-03-21"): "2038-03-20" TimeZone: Asia/Tehran
> java.sql.Date.valueOf("2038-03-21"): "2038-03-20" TimeZone: Iran
>
> Regards,
> Thomas
>

-- 
Dag H. Wanvik, staff engineer
Sun Microsystems, Databases (JavaDB/Derby)
Haakon VII gt. 7b, N-7485 Trondheim, Norway
Tel: x43496/+47 73842196, Fax:  +47 73842101

Re: Date 2042-10-12 problem using Brasilia time zone

Posted by "Bernt M. Johnsen" <Be...@Sun.COM>.
>>>>>>>>>>>> Bernt M. Johnsen wrote (2008-11-04 16:55:47):
> Played around with java.util.Date and found that it is done correctly
> up to and including 2037 and errouneously from 2038. 

That is, given that the change to DST for Brazil is the second Sunday
in October, which is also wrong. It's now (from 2008) the 3rd Sunday
in October.

> I don't think it's a coincidence that the 32-bit number of seconds
> since 1970-01-01 expires (or wraps around) on 2038-01-19.......
> 
> -- 
> Bernt Marius Johnsen, Staff Engineer
> Database Technology Group, Sun Microsystems, Trondheim, Norway



-- 
Bernt Marius Johnsen, Staff Engineer
Database Technology Group, Sun Microsystems, Trondheim, Norway

Re: Date 2042-10-12 problem using Brasilia time zone

Posted by "Bernt M. Johnsen" <Be...@Sun.COM>.
Played around with java.util.Date and found that it is done correctly
up to and including 2037 and errouneously from 2038. I don't think
it's a coincidence that the 32-bit number of seconds since 1970-01-01
expires (or wraps around) on 2038-01-19.......

-- 
Bernt Marius Johnsen, Staff Engineer
Database Technology Group, Sun Microsystems, Trondheim, Norway

Re: Date 2042-10-12 problem using Brasilia time zone

Posted by Lance Andersen <La...@Sun.COM>.
On Nov 4, 2008, at 8:10 AM, Thomas Mueller wrote:

> Hi,
>
>> this is *not* an issue with java.sql.Date.
>
> I am not sure about that.

java.sql.Date is nothing but a wrapper to java.util.Date, so what you  
pass in to the valueOf get passed directly to the constructor of  
java.util.Date(int,int, int).  All of the work is done in  
java.util.Date.


Regards
Lance
>
>
>> java.sql.Date.valueOf()  calls java.util.Date(int,int,int) and if  
>> you modify
>> your test program, you will see the same results from java.util.Date.
>
> I submitted the problem even without knowing the exact root cause. If
> you found the root cause of the problem, or if you even know how to
> fix it, that would be great of course!
>
> It looks like midnight of that day doesn't exist because it is the
> beginning or end of the daylight saving time. Where I live this change
> occurs at 2 am, but in some countries the change is at or near
> midnight. From what I know, java.util.Calendar doesn't allow to set
> 'invalid' hours, and if using the lenient setting it will 'fix' the
> time. Maybe the reason is that midnight of that day is set to 11 pm of
> the previous day. This change may be the expected behavior of
> java.util.Date / Calendar, but for java.sql.Date it is a problem. So
> maybe it is required to fix java.sql.Date, not java.util.Date. But I
> am not sure because I didn't debug it so far.
>
>> Please update any submitted bug
>
> I don't see a way to update the bug. I got a mail saying: "Your report
> has been assigned an internal review ID of 1384760, which is NOT
> visible on the Sun Developer Network (SDN)". There is no link.
>
> Regards,
> Thomas


Re: Date 2042-10-12 problem using Brasilia time zone

Posted by Thomas Mueller <th...@gmail.com>.
Hi,

> this is *not* an issue with java.sql.Date.

I am not sure about that.

> java.sql.Date.valueOf()  calls java.util.Date(int,int,int) and if you modify
> your test program, you will see the same results from java.util.Date.

I submitted the problem even without knowing the exact root cause. If
you found the root cause of the problem, or if you even know how to
fix it, that would be great of course!

It looks like midnight of that day doesn't exist because it is the
beginning or end of the daylight saving time. Where I live this change
occurs at 2 am, but in some countries the change is at or near
midnight. From what I know, java.util.Calendar doesn't allow to set
'invalid' hours, and if using the lenient setting it will 'fix' the
time. Maybe the reason is that midnight of that day is set to 11 pm of
the previous day. This change may be the expected behavior of
java.util.Date / Calendar, but for java.sql.Date it is a problem. So
maybe it is required to fix java.sql.Date, not java.util.Date. But I
am not sure because I didn't debug it so far.

>  Please update any submitted bug

I don't see a way to update the bug. I got a mail saying: "Your report
has been assigned an internal review ID of 1384760, which is NOT
visible on the Sun Developer Network (SDN)". There is no link.

Regards,
Thomas

Re: Date 2042-10-12 problem using Brasilia time zone

Posted by Lance Andersen <La...@Sun.COM>.
Also,

this is *not* an issue with java.sql.Date.

java.sql.Date.valueOf()  calls java.util.Date(int,int,int) and if you  
modify your test program, you will see the same results from  
java.util.Date.  Please update any submitted bug to reference  
java.util.Date accordingly and validate as Bernt states that TZupdater  
does/does not addresss your problem and indicate that in the bug.


On Nov 4, 2008, at 3:21 AM, Bernt M. Johnsen wrote:

> Hav you tried the tzupdater to see if the lates version of tzdata
> fixes the problem? tzdata2008g/TZupdater 1.3.9 is newer than JRE 6u10
> and contains changes for Brazil.
>
>
>>>>>>>>>>>>> Thomas Mueller wrote (2008-11-03 18:41:03):
>> Hi,
>>
>> I submitted a bug in JSE.
>>
>> Regards,
>> Thomas
>>
>>
>> On Sat, Nov 1, 2008 at 3:00 AM, Dag H. Wanvik <Da...@sun.com>  
>> wrote:
>>> Thomas Mueller <th...@gmail.com> writes:
>>>
>>> I got the same result on my box,
>>>
>>> 1.6.0_10-beta-b24
>>> SunOS
>>> :
>>>
>>> Dag
>>>
>>>
>>>> Hi,
>>>>
>>>> I just made a simple test case. Could you please run that and  
>>>> post the result?
>>>>
>>>> import java.sql.Date;
>>>> import java.util.TimeZone;
>>>> public class DateProblem {
>>>>    public static void main(String[] a) {
>>>>         
>>>> System.out.println(System.getProperty("java.runtime.version"));
>>>>        System.out.println(System.getProperty("os.name"));
>>>>        String[] ids = TimeZone.getAvailableIDs();
>>>>        for (int i = 0; i < ids.length; i++) {
>>>>            TimeZone.setDefault(TimeZone.getTimeZone(ids[i]));
>>>>            for (int y = 2037; y < 2039; y++) {
>>>>                for (int m = 101; m < 113; m++) {
>>>>                    for (int d = 101; d < 129; d++) {
>>>>                        test(y, m, d);
>>>>                    }
>>>>                }
>>>>            }
>>>>        }
>>>>    }
>>>>    static void test(int y, int m, int d) {
>>>>        String s = y + "-" + ("" + m).substring(1) + "-" + ("" +
>>>> d).substring(1);
>>>>        String s2 = Date.valueOf(s).toString();
>>>>        if (!s.equals(s2)) {
>>>>            String e = "java.sql.Date.valueOf(\"" + s + "\"): \""  
>>>> + s2 + "\"";
>>>>            e += " TimeZone: " + TimeZone.getDefault().getID();
>>>>            System.out.println(e);
>>>>        }
>>>>    }
>>>> }
>>>>
>>>> I get:
>>>> 1.6.0_05-b13
>>>> Windows XP
>>>> java.sql.Date.valueOf("2038-03-14"): "2038-03-13" TimeZone:  
>>>> America/Havana
>>>> java.sql.Date.valueOf("2038-03-14"): "2038-03-13" TimeZone: Cuba
>>>> java.sql.Date.valueOf("2038-10-17"): "2038-10-16" TimeZone:  
>>>> America/Asuncion
>>>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone:  
>>>> America/Campo_Grande
>>>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone:  
>>>> America/Cuiaba
>>>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone:  
>>>> America/Santiago
>>>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone:  
>>>> Antarctica/Palmer
>>>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: Chile/ 
>>>> Continental
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: AGT
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>>>> America/Argentina/Buenos_Aires
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>>>> America/Argentina/Catamarca
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>>>> America/Argentina/ComodRivadavia
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>>>> America/Argentina/Cordoba
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>>>> America/Argentina/Jujuy
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>>>> America/Argentina/La_Rioja
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>>>> America/Argentina/Mendoza
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>>>> America/Argentina/Rio_Gallegos
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>>>> America/Argentina/San_Juan
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>>>> America/Argentina/Tucuman
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>>>> America/Argentina/Ushuaia
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:  
>>>> America/Buenos_Aires
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:  
>>>> America/Catamarca
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:  
>>>> America/Cordoba
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:  
>>>> America/Jujuy
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:  
>>>> America/Mendoza
>>>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:  
>>>> America/Rosario
>>>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone:  
>>>> America/Sao_Paulo
>>>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: BET
>>>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone:  
>>>> Brazil/East
>>>> java.sql.Date.valueOf("2038-03-28"): "2038-03-27" TimeZone:  
>>>> America/Scoresbysund
>>>> java.sql.Date.valueOf("2038-03-28"): "2038-03-27" TimeZone:  
>>>> Atlantic/Azores
>>>> java.sql.Date.valueOf("2038-03-25"): "2038-03-24" TimeZone: Asia/ 
>>>> Amman
>>>> java.sql.Date.valueOf("2038-03-28"): "2038-03-27" TimeZone: Asia/ 
>>>> Beirut
>>>> java.sql.Date.valueOf("2038-03-26"): "2038-03-25" TimeZone: Asia/ 
>>>> Damascus
>>>> java.sql.Date.valueOf("2038-04-01"): "2038-03-31" TimeZone: Asia/ 
>>>> Gaza
>>>> java.sql.Date.valueOf("2038-03-21"): "2038-03-20" TimeZone: Asia/ 
>>>> Tehran
>>>> java.sql.Date.valueOf("2038-03-21"): "2038-03-20" TimeZone: Iran
>>>>
>>>> Regards,
>>>> Thomas
>>>>
>>>
>>> --
>>> Dag H. Wanvik, staff engineer
>>> Sun Microsystems, Databases (JavaDB/Derby)
>>> Haakon VII gt. 7b, N-7485 Trondheim, Norway
>>> Tel: x43496/+47 73842196, Fax:  +47 73842101
>>>
>
> -- 
> Bernt Marius Johnsen, Staff Engineer
> Database Technology Group, Sun Microsystems, Trondheim, Norway


Re: Date 2042-10-12 problem using Brasilia time zone

Posted by Thomas Mueller <th...@gmail.com>.
Hi,

> Hav you tried the tzupdater to see if the lates version of tzdata
> fixes the problem? tzdata2008g/TZupdater 1.3.9 is newer than JRE 6u10
> and contains changes for Brazil.

I just tried - it doesn't help.

Regards,
Thomas

Re: Date 2042-10-12 problem using Brasilia time zone

Posted by "Bernt M. Johnsen" <Be...@Sun.COM>.
Hav you tried the tzupdater to see if the lates version of tzdata
fixes the problem? tzdata2008g/TZupdater 1.3.9 is newer than JRE 6u10
and contains changes for Brazil.


>>>>>>>>>>>> Thomas Mueller wrote (2008-11-03 18:41:03):
> Hi,
> 
> I submitted a bug in JSE.
> 
> Regards,
> Thomas
> 
> 
> On Sat, Nov 1, 2008 at 3:00 AM, Dag H. Wanvik <Da...@sun.com> wrote:
> > Thomas Mueller <th...@gmail.com> writes:
> >
> > I got the same result on my box,
> >
> > 1.6.0_10-beta-b24
> > SunOS
> > :
> >
> > Dag
> >
> >
> >> Hi,
> >>
> >> I just made a simple test case. Could you please run that and post the result?
> >>
> >> import java.sql.Date;
> >> import java.util.TimeZone;
> >> public class DateProblem {
> >>     public static void main(String[] a) {
> >>         System.out.println(System.getProperty("java.runtime.version"));
> >>         System.out.println(System.getProperty("os.name"));
> >>         String[] ids = TimeZone.getAvailableIDs();
> >>         for (int i = 0; i < ids.length; i++) {
> >>             TimeZone.setDefault(TimeZone.getTimeZone(ids[i]));
> >>             for (int y = 2037; y < 2039; y++) {
> >>                 for (int m = 101; m < 113; m++) {
> >>                     for (int d = 101; d < 129; d++) {
> >>                         test(y, m, d);
> >>                     }
> >>                 }
> >>             }
> >>         }
> >>     }
> >>     static void test(int y, int m, int d) {
> >>         String s = y + "-" + ("" + m).substring(1) + "-" + ("" +
> >> d).substring(1);
> >>         String s2 = Date.valueOf(s).toString();
> >>         if (!s.equals(s2)) {
> >>             String e = "java.sql.Date.valueOf(\"" + s + "\"): \"" + s2 + "\"";
> >>             e += " TimeZone: " + TimeZone.getDefault().getID();
> >>             System.out.println(e);
> >>         }
> >>     }
> >> }
> >>
> >> I get:
> >> 1.6.0_05-b13
> >> Windows XP
> >> java.sql.Date.valueOf("2038-03-14"): "2038-03-13" TimeZone: America/Havana
> >> java.sql.Date.valueOf("2038-03-14"): "2038-03-13" TimeZone: Cuba
> >> java.sql.Date.valueOf("2038-10-17"): "2038-10-16" TimeZone: America/Asuncion
> >> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: America/Campo_Grande
> >> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: America/Cuiaba
> >> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: America/Santiago
> >> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: Antarctica/Palmer
> >> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: Chile/Continental
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: AGT
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> >> America/Argentina/Buenos_Aires
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> >> America/Argentina/Catamarca
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> >> America/Argentina/ComodRivadavia
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> >> America/Argentina/Cordoba
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> >> America/Argentina/Jujuy
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> >> America/Argentina/La_Rioja
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> >> America/Argentina/Mendoza
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> >> America/Argentina/Rio_Gallegos
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> >> America/Argentina/San_Juan
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> >> America/Argentina/Tucuman
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
> >> America/Argentina/Ushuaia
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Buenos_Aires
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Catamarca
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Cordoba
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Jujuy
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Mendoza
> >> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Rosario
> >> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: America/Sao_Paulo
> >> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: BET
> >> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: Brazil/East
> >> java.sql.Date.valueOf("2038-03-28"): "2038-03-27" TimeZone: America/Scoresbysund
> >> java.sql.Date.valueOf("2038-03-28"): "2038-03-27" TimeZone: Atlantic/Azores
> >> java.sql.Date.valueOf("2038-03-25"): "2038-03-24" TimeZone: Asia/Amman
> >> java.sql.Date.valueOf("2038-03-28"): "2038-03-27" TimeZone: Asia/Beirut
> >> java.sql.Date.valueOf("2038-03-26"): "2038-03-25" TimeZone: Asia/Damascus
> >> java.sql.Date.valueOf("2038-04-01"): "2038-03-31" TimeZone: Asia/Gaza
> >> java.sql.Date.valueOf("2038-03-21"): "2038-03-20" TimeZone: Asia/Tehran
> >> java.sql.Date.valueOf("2038-03-21"): "2038-03-20" TimeZone: Iran
> >>
> >> Regards,
> >> Thomas
> >>
> >
> > --
> > Dag H. Wanvik, staff engineer
> > Sun Microsystems, Databases (JavaDB/Derby)
> > Haakon VII gt. 7b, N-7485 Trondheim, Norway
> > Tel: x43496/+47 73842196, Fax:  +47 73842101
> >

-- 
Bernt Marius Johnsen, Staff Engineer
Database Technology Group, Sun Microsystems, Trondheim, Norway

Re: Date 2042-10-12 problem using Brasilia time zone

Posted by Thomas Mueller <th...@gmail.com>.
Hi,

I submitted a bug in JSE.

Regards,
Thomas


On Sat, Nov 1, 2008 at 3:00 AM, Dag H. Wanvik <Da...@sun.com> wrote:
> Thomas Mueller <th...@gmail.com> writes:
>
> I got the same result on my box,
>
> 1.6.0_10-beta-b24
> SunOS
> :
>
> Dag
>
>
>> Hi,
>>
>> I just made a simple test case. Could you please run that and post the result?
>>
>> import java.sql.Date;
>> import java.util.TimeZone;
>> public class DateProblem {
>>     public static void main(String[] a) {
>>         System.out.println(System.getProperty("java.runtime.version"));
>>         System.out.println(System.getProperty("os.name"));
>>         String[] ids = TimeZone.getAvailableIDs();
>>         for (int i = 0; i < ids.length; i++) {
>>             TimeZone.setDefault(TimeZone.getTimeZone(ids[i]));
>>             for (int y = 2037; y < 2039; y++) {
>>                 for (int m = 101; m < 113; m++) {
>>                     for (int d = 101; d < 129; d++) {
>>                         test(y, m, d);
>>                     }
>>                 }
>>             }
>>         }
>>     }
>>     static void test(int y, int m, int d) {
>>         String s = y + "-" + ("" + m).substring(1) + "-" + ("" +
>> d).substring(1);
>>         String s2 = Date.valueOf(s).toString();
>>         if (!s.equals(s2)) {
>>             String e = "java.sql.Date.valueOf(\"" + s + "\"): \"" + s2 + "\"";
>>             e += " TimeZone: " + TimeZone.getDefault().getID();
>>             System.out.println(e);
>>         }
>>     }
>> }
>>
>> I get:
>> 1.6.0_05-b13
>> Windows XP
>> java.sql.Date.valueOf("2038-03-14"): "2038-03-13" TimeZone: America/Havana
>> java.sql.Date.valueOf("2038-03-14"): "2038-03-13" TimeZone: Cuba
>> java.sql.Date.valueOf("2038-10-17"): "2038-10-16" TimeZone: America/Asuncion
>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: America/Campo_Grande
>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: America/Cuiaba
>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: America/Santiago
>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: Antarctica/Palmer
>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: Chile/Continental
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: AGT
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>> America/Argentina/Buenos_Aires
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>> America/Argentina/Catamarca
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>> America/Argentina/ComodRivadavia
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>> America/Argentina/Cordoba
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>> America/Argentina/Jujuy
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>> America/Argentina/La_Rioja
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>> America/Argentina/Mendoza
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>> America/Argentina/Rio_Gallegos
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>> America/Argentina/San_Juan
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>> America/Argentina/Tucuman
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone:
>> America/Argentina/Ushuaia
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Buenos_Aires
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Catamarca
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Cordoba
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Jujuy
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Mendoza
>> java.sql.Date.valueOf("2038-10-03"): "2038-10-02" TimeZone: America/Rosario
>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: America/Sao_Paulo
>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: BET
>> java.sql.Date.valueOf("2038-10-10"): "2038-10-09" TimeZone: Brazil/East
>> java.sql.Date.valueOf("2038-03-28"): "2038-03-27" TimeZone: America/Scoresbysund
>> java.sql.Date.valueOf("2038-03-28"): "2038-03-27" TimeZone: Atlantic/Azores
>> java.sql.Date.valueOf("2038-03-25"): "2038-03-24" TimeZone: Asia/Amman
>> java.sql.Date.valueOf("2038-03-28"): "2038-03-27" TimeZone: Asia/Beirut
>> java.sql.Date.valueOf("2038-03-26"): "2038-03-25" TimeZone: Asia/Damascus
>> java.sql.Date.valueOf("2038-04-01"): "2038-03-31" TimeZone: Asia/Gaza
>> java.sql.Date.valueOf("2038-03-21"): "2038-03-20" TimeZone: Asia/Tehran
>> java.sql.Date.valueOf("2038-03-21"): "2038-03-20" TimeZone: Iran
>>
>> Regards,
>> Thomas
>>
>
> --
> Dag H. Wanvik, staff engineer
> Sun Microsystems, Databases (JavaDB/Derby)
> Haakon VII gt. 7b, N-7485 Trondheim, Norway
> Tel: x43496/+47 73842196, Fax:  +47 73842101
>