Java Date Value Check isDateBefore(String date1)

Here you can find the source of isDateBefore(String date1)

Description

is Date Before

License

Open Source License

Declaration

public static boolean isDateBefore(String date1) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.DateFormat;
import java.text.ParseException;

public class Main {
    public static boolean isDateBefore(String date1) {
        try {//  w  w  w .j  av a 2  s .  c o m
            String date2 = date1.substring(0, 10) + " 23:59:59";
            DateFormat df = DateFormat.getDateTimeInstance();
            return df.parse(date1).before(df.parse(date2));
        } catch (ParseException e) {
            System.out.print("[SYS] " + e.getMessage());
            return false;
        }
    }
}

Related

  1. isDate(String strDate, String pattern)
  2. isDate(String strDate, String pattern)
  3. isDate(String text, String pattern)
  4. isDate(String val, SimpleDateFormat formatter)
  5. isDate(String value, Locale locale)
  6. isDateBefore(String date1, String date2)
  7. isDateBefore(String date1, String date2)
  8. isDateFormat(String dateString)
  9. isDateFormat(String str, String format)