package com.manishkprboilerplate.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by edge on 1/3/17.
 */

public class DateTime {

    public static boolean isDateGreater(String date_1, String date_2){
        return compare(date_1,date_2,new SimpleDateFormat("yyyy-MM-dd"));
    }

    public static boolean isFirstDateTimeGreater(String date_1, String date_2){
        return compare(date_1,date_2,new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
    }

    static boolean compare(String date_1, String date_2,SimpleDateFormat sdf){


        try {
            Date date2 = sdf.parse(date_1);
            Date date3 = sdf.parse(date_2);
            if(date3.compareTo(date2) < 0){
                return true;
            }
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return false;

    }

}

@@ -124,16 +124,41 @@
 il.Date;
+%0Aimport java.util.Locale;
 %0A%0A/**%0A *
@@ -173,12 +173,14 @@
  by 
-edge
+Munish
  on 
@@ -966,10 +966,266 @@
 %0A    %7D%0A%0A
+    public static String getDateTime() %7B%0A        return getDateTimeFormat(%22yyyy-MM-dd HH:mm:ss%22);%0A    %7D%0A%0A    public static String getDateTimeFormat(String format)%7B%0A        return new SimpleDateFormat(format, Locale.getDefault()).format(new Date());%0A    %7D%0A%0A
 %7D%0A

build 1.0.9