Java Parse Date Pattern YYYY parse(final String s)

Here you can find the source of parse(final String s)

Description

parse

License

Apache License

Declaration

public static Date parse(final String s) 

Method Source Code


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

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

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

    public static Date parse(final String s, final String fmt) {
        SimpleDateFormat sdf = new SimpleDateFormat(fmt);
        try {/* w w  w .j a v a2 s.  co  m*/
            return sdf.parse(s);
        } catch (ParseException e) {
        }
        return null;
    }

    public static Date parse(final String s) {
        try {
            return sdf1.parse(s);
        } catch (ParseException e) {
        }
        return null;
    }
}

Related

  1. parse(Class clazz, Object object)
  2. parse(Date d)
  3. parse(Date strDate, String pattern)
  4. parse(final String dateString)
  5. parse(final String inputDate)
  6. parse(final String source)
  7. parse(final String source)
  8. parse(Long date)
  9. parse(Long time)