aspose file tools*
The moose likes Java in General and the fly likes TimeZone Issues!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "TimeZone Issues!!" Watch "TimeZone Issues!!" New topic
Author

TimeZone Issues!!

Karthick Dharani Vidhya
Ranch Hand

Joined: Feb 23, 2008
Posts: 89
Hi,


Karthick D V
Karthick Dharani Vidhya
Ranch Hand

Joined: Feb 23, 2008
Posts: 89
Hi,

Sorry the first entry came blank as I was hitting the tab it took the control to Add Reply Button!!!

I have a date object say the cuttent date and time by new Date() - this gives me date and time as our local system time zone say the time part is 15:25:50.

But i need to convert this time to US time or Some other country's time and display it. How would i do that?
Collins Mbianda
Ranch Hand

Joined: Aug 11, 2007
Posts: 259
Hello Karthick !!!

what your question ? Lol


What's your time zone?


SCJP 5.0 | SCWCD 1.4
Collins Mbianda
Ranch Hand

Joined: Aug 11, 2007
Posts: 259
Ok,
you were typing very fast. Your post arrive before my one.

I hope the give a look to the link.
If you want to use TimeZone, use Calendar instead of Date.

You can get an instance the apposite TimeZone with

Calendar.getInstance(Locale aLocale) or
Calendar.getInstance(TimeZone zone, Locale aLocale)

Hope it help
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14428
    
  23

Note: You can click the button on your post to edit it, so that you don't need to add a reply to your own post.

Class Date does not know anything about timezones. You can use a SimpleDateFormat object to convert your Date object to a string that you can display, and you can tell the SimpleDateFormat in which timezone you want to see it. For example:

[ June 27, 2008: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Karthick Dharani Vidhya
Ranch Hand

Joined: Feb 23, 2008
Posts: 89
Hi all,

Thanks for the responses.

I tried setting the timezone to the calendar and calling gettime() on that. That was not working. But as you told when we set the timezone to the Formatter it worked!!!

Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TimeZone Issues!!