Java TimeZone Get getDateInTimeZone(final Date date, final TimeZone timeZone)

Here you can find the source of getDateInTimeZone(final Date date, final TimeZone timeZone)

Description

Get date in timezone

License

Apache License

Parameter

Parameter Description
date the date
timeZone the timezone

Return

a Calendar

Declaration

public static Calendar getDateInTimeZone(final Date date, final TimeZone timeZone) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    /**/*  w  w w. j a  v  a 2 s. c om*/
     * Get date in timezone
     *
     * @param date     the date
     * @param timeZone the timezone
     * @return a Calendar
     */
    public static Calendar getDateInTimeZone(final Date date, final TimeZone timeZone) {
        final Calendar calendar = Calendar.getInstance(timeZone);
        calendar.setTime(date);
        return calendar;
    }
}

Related

  1. getCalendarInstance(TimeZone timeZone, Locale locale)
  2. getConvertDateString(Date date, TimeZone tz, String fmt)
  3. getCurrentCalendarInTimeZone(final TimeZone timeZone)
  4. getCurrentTimeZone()
  5. getCurrentTimezoneOffset()
  6. getDefaultTimeZoneOffset()
  7. getDefaultTimeZoneRawOffset()
  8. getDefaultTimeZoneString()
  9. getDiffTimeZoneRawOffset(String timeZoneId)