Java TimeZone Get getCalendarForTimeZone(final String timeZone)

Here you can find the source of getCalendarForTimeZone(final String timeZone)

Description

Gets the calendar for time zone.

License

Open Source License

Parameter

Parameter Description
timeZone the time zone

Exception

Parameter Description
ParseException the parse exception

Return

the calendar for time zone

Declaration

public static Calendar getCalendarForTimeZone(final String timeZone) throws ParseException 

Method Source Code


//package com.java2s;
/*/*from   w  w w . jav a2  s.c o  m*/
 * DateUtil.java
 * Copyright (c) 2014, CODEROAD, All Rights Reserved.
 *
 * This software is the confidential and proprietary information of CODEROAD
 * ("Confidential Information"). You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you entered into with
 * CODEROAD.
 */

import java.text.ParseException;

import java.util.Calendar;

import java.util.Locale;

import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;

public class Main {
    /**
     * Gets the calendar for time zone.
     * 
     * @param timeZone the time zone
     * @return the calendar for time zone
     * @throws ParseException the parse exception
     */
    public static Calendar getCalendarForTimeZone(final String timeZone) throws ParseException {

        DateTime dateTime = new DateTime(DateTimeZone.forID(timeZone));
        Calendar tzCalendar = dateTime.toCalendar(Locale.ENGLISH);
        return tzCalendar;
    }
}

Related

  1. getAdjustedDateTime(Date dt, TimeZone tz)
  2. getAllTimezonesSorted()
  3. getAsTimeZone(Map params, String propName)
  4. getAvailableTimezones()
  5. getCal(int dayOfMonth, int month, int year, int hours, int minutes, int seconds, String timezone)
  6. getCalendarInstance(TimeZone timeZone, Locale locale)
  7. getConvertDateString(Date date, TimeZone tz, String fmt)
  8. getCurrentCalendarInTimeZone(final TimeZone timeZone)
  9. getCurrentTimeZone()