Java Parse Date Pattern YYYY parseString2Date(String sDate, String format)

Here you can find the source of parseString2Date(String sDate, String format)

Description

parse String Date

License

Open Source License

Declaration

public static Date parseString2Date(String sDate, String format) throws ParseException 

Method Source Code

//package com.java2s;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

public class Main {

    public static Date parseString2Date(String sDate, String format) throws ParseException {
        if (format == null || "".equals(format)) {
            format = "yyyy-MM-dd HH:mm:ss";
        }//w  w w .j a v  a2 s.  co  m
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.parse(sDate);
    }
}

Related

  1. parseString(String date)
  2. parseString(String dateStr)
  3. parseString(String strDate)
  4. parseString2Calendar(String date)
  5. parseString2Date(String date)
  6. parseString2Long(String strDate)
  7. parseStringAsDate(String pattern, String value)
  8. parseStringDate(String dateAsString)
  9. parseStringDateToRmFormat(String date)