db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dag.Wan...@Sun.COM (Dag H. Wanvik)
Subject Re: Date 2042-10-12 problem using Brasilia time zone
Date Sat, 01 Nov 2008 02:00:26 GMT
Thomas Mueller <thomas.tom.mueller@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

Mime
View raw message