Java Calendar from Date getCalendar(Date dt, TimeZone to)

Here you can find the source of getCalendar(Date dt, TimeZone to)

Description

Get the timezone specific calendar.

License

Open Source License

Declaration

public static Calendar getCalendar(Date dt, 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   ww w  .  ja  v a2 s .  c om*/
 * Contributors:
 *    Eike Stepper - initial API and implementation
 **************************************************************************/

import java.util.Calendar;
import java.util.Date;

import java.util.TimeZone;

public class Main {
    /**
     * Get the timezone specific calendar.
     */
    public static Calendar getCalendar(Date dt, TimeZone to) {
        Calendar cal = Calendar.getInstance(to);
        cal.setTime(dt);
        return cal;
    }
}

Related

  1. getCalendar(Date date)
  2. getCalendar(Date date)
  3. getCalendar(Date date, int firstDayOfWeek)
  4. getCalendar(Date date, int step)
  5. getCalendar(Date dt)
  6. getCalendar(Date inputDate)