Java Parse Date Pattern YYYY parse(String param)

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

Description

Parse a datetime string.

License

Apache License

Parameter

Parameter Description
param datetime string, pattern: "yyyy-MM-dd HH:mm:ss".

Return

java.util.Date

Declaration

public static Date parse(String param) 

Method Source Code


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

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

public class Main {
    /**//from  w  w  w.j a  v  a 2 s. co m
     * Parse a datetime string.
     * 
     * @param param
     *          datetime string, pattern: "yyyy-MM-dd HH:mm:ss".
     * @return java.util.Date
     */
    public static Date parse(String param) {
        Date date = null;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            date = sdf.parse(param);
        } catch (ParseException e) {
        }
        return date;
    }
}

Related

  1. parse(String ds)
  2. parse(String format, String val)
  3. parse(String input)
  4. parse(String original)
  5. parse(String param)
  6. parse(String s)
  7. parse(String s)
  8. parse(String s)
  9. parse(String s)