Here you can find the source of getTimeAsPerTimeZone(String time, String timeZOne)
Parameter | Description |
---|---|
time | the time |
timeZOne | the time z one |
public static String getTimeAsPerTimeZone(String time, String timeZOne)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.TimeZone; public class Main { /**/*from www .j a v a2s .c o m*/ * Gets the time as per time zone. * * @param time * the time * @param timeZOne * the time z one * @return the time as per time zone */ public static String getTimeAsPerTimeZone(String time, String timeZOne) { time = time.split("Minutes")[1]; DateFormat formatter = new SimpleDateFormat("hh:mm a"); TimeZone tz = TimeZone.getTimeZone("EST5EDT"); Calendar cal = new GregorianCalendar(tz); cal.add(Calendar.MINUTE, Integer.parseInt(time)); formatter.setTimeZone(tz); return formatter.format(cal.getTime()); } }