Two Laptop Bag
The moose likes Java in General and the fly likes how to get the date in required timezone? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "how to get the date in required timezone?" Watch "how to get the date in required timezone?" New topic
Author

how to get the date in required timezone?

Suresh K Babu
Greenhorn

Joined: Feb 10, 2007
Posts: 16
Hi All,

Can anybody please let me know how to get the date in required timezone?
I tried with below java program, but it is returning date properly except timezone for the date as given in output.
How to I get proper timezone as well?

Appreciated your help.



Program output:

Current Time=Wed Jun 09 23:28:55 IST 2010
Current Timezone=India Standard Time
Getting Time in the timezone=Canada/Central
Current Time there=Wed Jun 09 12:58:55 IST 2010

Thanks,
Suresh
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4163
    
    3

Suresh K Babu wrote: it is returning date properly except timezone for the date as given in output.

Oh, but it is. When it's Wed Jun 09 23:28:55 2010 in Canada/Central it's Wed Jun 09 12:58:55 2010 in India.

Now if you want the String representation of that date in Canada/Central time, use an appropriate SimpleDateFormat.


luck, db
There are no new questions, but there may be new answers.
John de Michele
Rancher

Joined: Mar 09, 2009
Posts: 600
Shouldn't that be Thursday, June 10th? Indian Standard Time is ahead of CDT.

John.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get the date in required timezone?
 
Similar Threads
Replacement of deprecated constructor
Compare time (time difference in java)
Java util Date & Calendar - 1900 years
How to revert back to original TimeZone
Reading the Date and time values from excel sheet