Java TimeZone Format getString(Date dt, DateFormat df, TimeZone to)

Here you can find the source of getString(Date dt, DateFormat df, TimeZone to)

Description

Get the timezone specific string.

License

Open Source License

Declaration

public static String getString(Date dt, DateFormat df, TimeZone to) 

Method Source Code

//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);
    }
}

Related

  1. getCalendar(String dateString, String format, TimeZone tz)
  2. getDefaultDateFormatWithoutTimeZone( TimeZone zone)
  3. getDefaultDateFormatWithTimeZone()
  4. getFormattedTime(Date time, String formatTime, String timezone)
  5. getSimpleDateFormat(TimeZone timeZone, String pattern)
  6. getTimeByZoneAndFormat(Date date, TimeZone zone, String format)
  7. getTimeWithFormat(String stringDate, String dateFormat, DateTimeZone timeZone, Locale locale)
  8. getTimezoneFormattedString(Date date, String timezone)
  9. getUserToServerDateTimeString(TimeZone timeZone, int dateFormat, int timeFormat, String date)