aspose file tools
The moose likes Java in General and the fly likes calendar timezone Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

calendar timezone

samantha clarkson
Ranch Hand

Joined: Sep 09, 2008
Posts: 48
Hello, i have a gregorian calendar, i apply a timezone, then i retrieve the date, but it's displayed in GMT timezone , what can i do for retrieving a date from a calendar with a specified timezone .
After, i have to use a jcalendar which display the time coresponding to the time zone of the server machine, what could i do to get a calendar displaying date/time coresponding to a server machine not the mine.

Code :
TimeZone tz = TimeZone.getTimeZone("America/Caracas");
System.out.println("TZ ID : "+tz.getID());
System.out.println("TZ display name : "+tz.getDisplayName());
GregorianCalendar c = new GregorianCalendar();
c.setTimeZone(tz);
System.out.println("c TZ ID : "+c.getTimeZone().getID());
System.out.println("c TZ display name : "+c.getTimeZone().getDisplayName());
System.out.println("c time : "+c.getTime().toString());

Output :
TZ ID : America/Caracas
TZ display name : Heure du Venezuela
c TZ ID : America/Caracas
c TZ display name : Heure du Venezuela
c time : Sun May 31 13:16:08 GMT 2009

Thanks .


farm rubbit hihihihihihi, be aware !!
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3032
    
    4

This is a repeat of the question you already posted in in your other thread. Please stick to one thread, and if you feel the need to crosspost, at least let others know you are doing so, so as to avoid repeat answers.


Steve
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3268

Locking this one.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: calendar timezone
 
Similar Threads
Question about using a specific TimeZone to set a GregorianCalendar...
settimezone on gregorian calendar doesn't work !!
Need Help on Time conversion.
Problem on great datetime in GMT
Converting from GMT to Local Timezone using two seperate fields (date & time).