Here you can find the source of getString(Date dt, DateFormat df, TimeZone to)
public static String getString(Date dt, DateFormat df, TimeZone to)
//package com.java2s; /*************************************************************************** * Copyright (c) 2006 Eike Stepper, Fuggerstr. 39, 10777 Berlin, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * /*from w ww .jav a2 s.com*/ * Contributors: * Eike Stepper - initial API and implementation **************************************************************************/ import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class Main { /** * Get the timezone specific string. */ public static String getString(Date dt, DateFormat df, TimeZone to) { df.setTimeZone(to); return df.format(dt); } }