Java Parse Date Pattern YYYY parseCalendarString(String dateTimeString)

Here you can find the source of parseCalendarString(String dateTimeString)

Description

Converts a dateTimeString and makes a Calendar object

License

Apache License

Parameter

Parameter Description
dateTimeString in format 2012-10-15T08:17:00

Return

Calendar object

Declaration

public static Calendar parseCalendarString(String dateTimeString) 

Method Source Code

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

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

public class Main {
    /**/*ww  w. java2s .c o m*/
     *Converts a dateTimeString and makes a Calendar object
     * @param dateTimeString in format 2012-10-15T08:17:00
     * @return Calendar object
     * */
    public static Calendar parseCalendarString(String dateTimeString) {
        SimpleDateFormat dateFormat = new SimpleDateFormat(
                "yyyy-MM-dd'T'HH:mm:ss");
        Date date = null;
        try {
            date = dateFormat.parse(dateTimeString);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        Calendar cal = Calendar.getInstance();
        cal.setTimeZone(TimeZone.getTimeZone("Europe/Stockholm"));
        cal.setTime(date);
        return cal;
    }
}

Related

  1. parseAsDateTime(String date)
  2. parseAtomDate(String date_str)
  3. parseBingDate(String dateString)
  4. parseBitcoin(String calendarString)
  5. parseCalendar2String(Calendar calendar)
  6. parseCDADateFormat(String xsdDate)
  7. parseCompactDate(String exp)
  8. parseCoTDate(String dateString)
  9. parseDatabaseDate(String dateString)