Here you can find the source of convertTimezone(Date date, String destZone, String dateFormat)
Parameter | Description |
---|---|
date | a parameter |
destZone | a parameter |
dbFormat | a parameter |
public static String convertTimezone(Date date, String destZone, String dateFormat)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { /**// w w w.java 2 s.com * Converts a date into another timezone. * TODO: not sure that works - needs testing. * @param date * @param destZone * @param dbFormat * @return */ public static String convertTimezone(Date date, String destZone, String dateFormat) { DateFormat df = new SimpleDateFormat(dateFormat); df.setTimeZone(TimeZone.getTimeZone(destZone)); return df.format(date); } }