Java Parse Date parseDate(String dateStr)

Here you can find the source of parseDate(String dateStr)

Description

parse Date

License

Apache License

Declaration

public static Date parseDate(String dateStr) 

Method Source Code


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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static Date parseDate(String dateStr, String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        try {/*from  w  w  w  .  j  a  v  a2  s.  com*/
            return sdf.parse(dateStr);
        } catch (Exception e) {
            return null;
        }
    }

    public static Date parseDate(String dateStr) {
        return parseDate(dateStr, "yyyy-MM-dd");
    }
}

Related

  1. parseDate(String datestr)
  2. parseDate(String dateStr)
  3. parseDate(String dateStr)
  4. parseDate(String dateStr)
  5. parseDate(String dateStr)
  6. parseDate(String dateStr)
  7. parseDate(String dateStr)
  8. parseDate(String dateStr)
  9. parseDate(String dateStr)