Oracle java 1.6 using wrong time zone with new introduced time zone "Europe/Busingen"
Issue
We were having issues where the default timezone in java was wrong.
# date; java simpleTest
Wed Aug 21 11:21:31 CEST 2013
Simple test
TIME ZONE :GMT+01:00
Value of milliseconds since Epoch is 1377076891700
Value of s in readable format is Wed Aug 21 10:21:31 GMT+01:00 2013
But /etc/localtime seemed to be perfect:
zdump /etc/localtime
/etc/localtime Wed Aug 21 11:30:08 2013 CEST
# md5sum /etc/localtime; md5sum /usr/share/zoneinfo/Europe/Zurich
1e7d70d8f8b7c4343edfa482a1d6f9b6 /etc/localtime
1e7d70d8f8b7c4343edfa482a1d6f9b6 /usr/share/zoneinfo/Europe/Zurich
Deleting the /etc/localtime file and symlink /usr/share/zoneinfo/Europe/Zurich to /etc/localtime seemed to fix the problem.
Javacode used to check:
import java.util.*;
import java.text.*;
class simpleTest
{
public static void main(String args[])
{
System.out.println("Simple test");
Date now = new Date();
DateFormat df = DateFormat.getDateInstance();
Calendar cal = Calendar.getInstance();
System.out.println("\n TIME ZONE :"+ cal.getTimeZone().getDisplayName());
long nowLong = now.getTime();
String s = now.toString();
System.out.println("Value of milliseconds since Epoch is " + nowLong);
System.out.println("Value of s in readable format is " + s);
}
}
Environment
- Red Hat Enterprise Linux 5.9
- java-1.6.0-sun-1.6.0.45-1jpp.1.el5_9.x86_64
- tzdata-2013c-2.el5.x86_64
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
