I am trying to run a java program, but it is taking a default GMT timezone instead of a OS defined timezone. My jdk version is 1.5 and the OS is Windows Server Enterprise (2007)
Windows has a Central timezone specified, but when I run the following program, it gives me a GMT time.
import java.util.Calendar;
public class DateTest
{
public static void main(String[] args)
{
Calendar now = Calendar.getInstance();
System.out.println(now.getTimeZone());
System.out.println(now.getTime());
}
}
Here is the output
sun.util.calendar.ZoneInfo[id="GMT",
offset=0,
dstSavings=0,
useDaylight=false,
transitions=0,
lastRule=null]
Mon Mar 22 13:46:45 GMT 2010
Please note that I do not want to set the timezone from the application. I want that the timezone used by JVM should be the one specified in the OS. (I am not finding this issues with other servers that have version 1.4 of jdk and Microsoft Server 2003).
Any thoughts would be highly appreciated.