Java Parse Date Pattern YYYY parse(String datestring)

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

Description

parse

License

Open Source License

Declaration

public static Calendar parse(String datestring) 

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.Date;

public class Main {
    private static final DateFormat DATE_PARSER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static Calendar parse(String datestring) {
        // Format
        Date date = new Date();
        try {//  w w  w  .  j a  va  2 s .c o m
            date = DATE_PARSER.parse(datestring);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        return cal;
    }
}

Related

  1. parse(String dateString)
  2. parse(String dateString)
  3. parse(String DateString)
  4. parse(String dateString)
  5. parse(String dateString)
  6. parse(String dateString)
  7. parse(String dateString)
  8. parse(String dateString)
  9. parse(String dateString, String dateFormat)