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 <[EMAIL PROTECTED]>
wrote:
Thomas Mueller <[EMAIL PROTECTED]> 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