Android Date String Parse parse(String date)

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

Description

parse

Declaration

public static Date parse(String date) 

Method Source Code

//package com.java2s;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static Date parse(String date, String format) {
        DateFormat sdf = new SimpleDateFormat(format);
        try {/* w w w  . j av  a 2s. com*/
            return sdf.parse(date);
        } catch (ParseException e) {
        }

        return null;
    }

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

    public static Date parse(String date, boolean isDateOnly) {
        if (isDateOnly) {
            return parse(date);
        } else {
            return parse(date, "yyyy-MM-dd HH:mm");
        }
    }
}

Related

  1. ISO8601ToTimestamp(String aDate)
  2. ParseStringToDate(String date)
  3. getDateByTime(String time)
  4. isDateString(String dirtyDate)
  5. isDateTimeString(String dirtyDateTime)
  6. parse(String date, String format)
  7. parse(String date, boolean isDateOnly)
  8. parse(String dateString, String dateFormat)
  9. parse(String src)