Java TimeZone Format getCalendar(String dateString, String dateTimeFormat, String timeZoneName)

Here you can find the source of getCalendar(String dateString, String dateTimeFormat, String timeZoneName)

Description

get Calendar

License

Open Source License

Declaration

public static Calendar getCalendar(String dateString, String dateTimeFormat, String timeZoneName)
            throws ParseException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;

public class Main {
    public static Calendar getCalendar(String dateString, String dateTimeFormat, String timeZoneName)
            throws ParseException {
        DateFormat dateFormat = new SimpleDateFormat(dateTimeFormat);
        dateFormat.setTimeZone(TimeZone.getTimeZone(timeZoneName));
        Calendar disbursementCalendar = Calendar.getInstance(TimeZone.getTimeZone(timeZoneName));
        disbursementCalendar.setTime(dateFormat.parse(dateString));
        return disbursementCalendar;
    }/*from  ww w. ja v a 2  s.co  m*/
}

Related

  1. createDateFormat(TimeZone timezone)
  2. createDateFormatsForLocaleAndTimeZone(Locale locale, TimeZone timeZone)
  3. formatISO8601TimeZone(TimeZone timeZone, boolean extended)
  4. formatOffset(TimeZone zone)
  5. formatTimeZoneOffset(TimeZone timeZone)
  6. getCalendar(String dateString, String format, TimeZone tz)
  7. getDefaultDateFormatWithoutTimeZone( TimeZone zone)
  8. getDefaultDateFormatWithTimeZone()
  9. getFormattedTime(Date time, String formatTime, String timezone)