Compare Two String Date and Time in android?

前端 未结 9 636
北海茫月
北海茫月 2020-12-15 04:54

I have Two String Datetime as follows:

String Date1 = \"05-09-2013 10:46:10\"
String Date2 = \"06-09-2013 10:46:10\"

I Need to compare thes

9条回答
  •  时光说笑
    2020-12-15 05:25

    Try this,

    String pattern = "";
    SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
    try {
     Date one = dateFormat.parse();
     Date two = dateFormat.parse();
    
    }
    catch (ParseException e) {}
    

提交回复
热议问题