TimeZone problem

I want to have the time (ExactTime). Like GMT+08:00(Singapore).

Is that possible to get the time Exactly same as our TimeZone.

I tried with the help of the TimeZone class to change the TimeZone,Even then the Default value was displaying

Can you please give me some suggestion that i will get the Exact time

Thanks in advance

kelvin

[368 byte] By [emerge87a] at [2007-11-27 7:46:11]
# 1
strange...can you show us code (please use the Formatting tips: http://forum.java.sun.com/help.jspa?sec=formatting)
suparenoa at 2007-7-12 19:27:02 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2
ok jus tell u a brief of wat i am doing. i write a writeToFile method, this method will write some message and the date and time into some text file.i simply tried "new Date();" but it giving me UTC but i wan singapore time GMT +8:00
emerge87a at 2007-7-12 19:27:02 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3

you have to use a Calendar, a Date and a TimeZone..

...

Calendar calendar=Calendar.getInstance();

calendar.setTimeZone(new TimeZone(<singapore_TimeZone>));

calendar.setTime(new Date()); // it would work with out this, you have to test

Date mySingaporeDate=calendar.getTime();

...

see corresponding javadoc for more infos

suparenoa at 2007-7-12 19:27:02 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4
hi thx for the info but the time still remain as UTC. For ur info i am using WTK2.5, here is the codes tt i have tried:Calendar calendar=Calendar.getInstance();TimeZone tz = TimeZone.getTimeZone("CST");calendar.setTimeZone(tz);Date sgdt
emerge87a at 2007-7-12 19:27:02 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5
eg. Fri Jun 15 12:00:22 UTC 2007
emerge87a at 2007-7-12 19:27:03 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 6
check out this article http://java.sun.com/developer/JDCTechTips/2003/tt1104.html#2or you can just get UTC date and add 8 hours to the current date to get the real singapore date
suparenoa at 2007-7-12 19:27:03 > top of Java-index,Java Mobility Forums,Java ME Technologies...