File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Calendar Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Calendar Class" Watch "Calendar Class" New topic

Calendar Class

Nischal Tanna
Ranch Hand

Joined: Aug 19, 2003
Posts: 182
Hi Guys..
I m having a small probs here..
I require my sysdate to be shown as per s specific timezone and Locale..for eg..
If i require to show the United States time..and also the date..
for eg..i have some code written ..but i m not getting the required answer..
//For indian standard time..
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+05:30"));
int hour12 = cal.get(Calendar.HOUR_OF_DAY);
The same i want for United States..also guys check out the output of the abve code..i guess not a perfect answer ...
neways hoping lot of replies..

Amit KumarS
Ranch Hand

Joined: Oct 10, 2003
Posts: 100
i think ur code is alright.. i can't figure our any probs with that... only thing is that it is returning hours in 24 hrs format.. if u want it in 12 hr format then istaed of

you should write

and for american time you can write..

i hope i am clear.. for any quesries please revert back..

****************************<br />In 24 hrs Earth rotates once on its Axis.
I agree. Here's the link:
subject: Calendar Class
It's not a secret anymore!