Alex Rivera | Logout

Timezone conversion

Asked 2011-07-04T06:15:18.040
60

I need to convert from one timezone to another timezone in my project.

I am able to convert from my current timezone to another but not from a different timezone to another.

For example I am in India, and I am able to convert from India to US using Date d=new Date(); and assigning it to a calendar object and setting the time zone.

However, I cannot do this from different timezone to another timezone. For example, I am in India, but I am having trouble converting timezones from the US to the UK.

Edit
Report

1 Answer

2

You can do something like this to get the current time in another time zone.

Calendar japanCal = new GregorianCalendar(TimeZone.getTimeZone("Japan"));
japanCal.setTimeInMillis(local.getTimeInMillis());
answered 2011-07-04T06:19:05.767

Your Answer