Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to get the date in required timezone?  RSS feed

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shouldn't that be Thursday, June 10th? Indian Standard Time is ahead of CDT.

John.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!