Java Parse Date Pattern YYYY parse(String calendarString)

Here you can find the source of parse(String calendarString)

Description

parse

License

Apache License

Declaration

public static Calendar parse(String calendarString) 

Method Source Code


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

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    public static Calendar parse(String calendarString) {
        try {//from  www  . j  a  v  a 2  s.  co  m
            Date date = getDateFormat().parse(calendarString);
            Calendar cal = new GregorianCalendar();
            cal.setTime(date);
            return cal;
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }

    private static DateFormat getDateFormat() {
        DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
        return formatter;
    }
}

Related

  1. parse(final String source)
  2. parse(final String source)
  3. parse(Long date)
  4. parse(Long time)
  5. parse(Object object)
  6. parse(String d)
  7. parse(String date)
  8. parse(String date)
  9. parse(String date)