Results 1 to 3 of 3
- 06-24-2011, 05:59 AM #1
Member
- Join Date
- Jun 2011
- Posts
- 2
- Rep Power
- 0
Timezone issues with SG timezone on Windows 2003
Hi, I created a simple java application to test out the timezone settings on a Windows 2003 server.
The server has been set to take the "(GMT +08:00) Kuala Lumpur, Singapore" timezone via the Date/Time control panel. Below is the application code and result:
-----
(Code)
import java.text.*;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
public class TestDate {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Date dt = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
System.out.println("With a java.util.Date object of "+dt+" todays date is "+df.format(dt));
System.out.println(Locale.getDefault().toString()) ;
System.out.println("Timezone: "+ TimeZone.getDefault().getID());
System.out.println("UTCOffset: " + (TimeZone.getDefault().getRawOffset()/(60*60*1000)) + " , DST:" + (TimeZone.getDefault().getDSTSavings()/(60*60*1000)));
}
}
-----
(Result)
With a java.util.Date object of Fri Jun 24 03:59:25 GMT 2011 todays date is 20110624
en_GB
Timezone: GMT
UTCOffset: 0 , DST:0
-------
When set to HongKong(China Standard Time), I get the results as expected:
-------
With a java.util.Date object of Fri Jun 24 12:00:26 CST 2011 todays date is 2011
0624
en_GB
Timezone: Asia/Shanghai
UTCOffset: 8 , DST:0
-------
Has anyone come across the above before and how can I resolve this other than explicitly setting the JVM user.timezone parameters?
Thanks.
- 06-24-2011, 06:39 AM #2
When I changed the time zone to Kuala Lumpur & Singapore I got Asia/Singapore as output. It would seem one or more of your assumptions are incorrect.
- 06-24-2011, 10:31 AM #3
Member
- Join Date
- Jun 2011
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
TimeZone confusion
By justc1 in forum Advanced JavaReplies: 1Last Post: 06-22-2011, 07:31 AM -
Timezone in java
By deeparanbhor in forum New To JavaReplies: 0Last Post: 05-28-2009, 01:12 PM -
Regarding olson timezone database
By navneet.tech2009@gmail.co in forum New To JavaReplies: 0Last Post: 09-23-2008, 12:47 PM -
How to use TimeZone class of java
By Java Tip in forum java.utilReplies: 0Last Post: 04-06-2008, 07:39 PM -
How to accurately test if timezone data is updated?
By Santhosh in forum Advanced JavaReplies: 0Last Post: 11-14-2007, 06:53 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks