Java String to Date toDate(String dateStr)

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

Description

to Date

License

Apache License

Declaration

public static Date toDate(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 toDate(String dateStr) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        try {/*from w ww  .j  a va 2s.co  m*/
            return sdf.parse(dateStr);
        } catch (Exception e) {
            return null;
        }
    }
}

Related

  1. toDate(String date)
  2. toDate(String date, String dateFormat)
  3. toDate(String date, String format)
  4. toDate(String date, String format)
  5. toDate(String date, String format)
  6. toDate(String dateStr)
  7. toDate(String dateStr, String format)
  8. toDate(String dateStr, String pattern)
  9. toDate(String dateString)