This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Changing TimeZone of Date. 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 Bookmark "Changing TimeZone of Date. " Watch "Changing TimeZone of Date. " New topic
Author

Changing TimeZone of Date.

R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5369
I want to convert my Date timezone from local setting to say Zulu.

First of all Date class does not support setting of TimeZone [method is depricated.]

I have found a way to change the timeZone, but I am not very sure if its the best way to change the TimeZone.

Following is the code which currently works fine.


I am not comfortable with the idea of first getting String and then actually getting the changed date.

Is there any better way to change the TimeZone ???

Thanks in advance.

This following program is my test program, in case if one wants to run the code.



"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5369
still wondering, I doubt that its the best way to change the timezone?

I think, its not necessary to first convert to String and then get the changed timeZone.
I will really appreciate if someone has used or know any other alternate way to change the timezone.

Thanks in advance.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Changing TimeZone of Date.
 
Similar Threads
Problem in Changing Timezone (URGENT)
UTC formatting
TimeZone Conversion
Date Parsing Issue...
Calendar.set(HOUR_OF_DAY, 1) confusion