Monday, 4 January 2016

How to compare dates in android or Java (String format dates compare in java)



  Here is the example to compare 2 string format dates :
 
 
 String dateOneStr = "12/02/2016";
        String dateTwoStr = "13/02/2016";
        Date date1,date2;
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy"); 
    try {
     date1 = df.parse(dateOneStr);
     date2 = df.parse(dateTwoStr);
       
        if(date1.after(date2)){
               System.out.println("Date1 is after Date2");
           }

           if(date1.before(date2)){
               System.out.println("Date1 is before Date2");
           }

           if(date1.equals(date2)){
               System.out.println("Date1 is equal Date2");
           }
       
    } catch (ParseException e) {
        e.printStackTrace();
    }

Android SQLite Database Viewer or Debuging with Stetho

Every Android Developer uses SQLite Database to store data into the Android Application data. But to view the data in SQLite have a lot of...