I am parsing an XML file which provides me Date,Time Zone for UK and US. Date is fine but the time it provides me is in the Formate 17:00:00 UK and corresponding 12:00:00 US for same event. I would like to convert the time in the Formate 12:00 PM for US and 5:00 PM for UK. Can some one help me how I can acheive this. I have a separate object which contain both this information, I tried setting the TimeZone to UK and US but didn't work any help will be appreciated
Thanks for replying, This is the XML formate which has Date,Time and TimeZone in separate attribute. Which I am populating in the separate String. <DisplayableDateTime TimeZone="ET" EventStartDate="20080507" EventStartTime="12:00:00"/> <DisplayableDateTime TimeZone="UKT" EventStartDate="20080507" EventStartTime="17:00:00"/> i.e String TimeZone = ET String StartDate =20080507 StartTime = 12:00:00 etc.....
here is an example. that shows how to format time to have a AM/PM text using Java SimpleDateFormat.
hope it helps. [ June 11, 2008: Message edited by: Muhammad Saifuddin ]
Manu Garg
Greenhorn
Joined: Feb 06, 2006
Posts: 6
posted
0
Thanks again...This code can work only for the UST since the time for the UK will be different. I think I will have to set the locale before issuing the SimpleDateFormate...
Vilmantas Baranauskas
Ranch Hand
Joined: Dec 20, 2006
Posts: 89
posted
0
You could do following:
I am afraid there is no such time zone as "UK".
Author of <a href="http://www.newsinjector.com" target="_blank" rel="nofollow">NewsInjector</a>
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18641
posted
0
And the idea of a "UST" is even more nonsensical. We've got four time zones in the continental US, plus at least two for Alaska and Hawaii. I'm too lazy to look up other places like Guam to see how they would change the total, or to argue about whether they should be considered. And inconsistencies in the adoption of Daylight Saving Time (evil blight on humanity that it is) make the issue even more complicated. If you want to see a 5-hour difference between the "US" and Britain, then you must mean the East Coast of the US. If you use TimeZone.getTimeZone("America/New_York"), that should work.