How to compare two dates along with time in java

后端 未结 6 1600
独厮守ぢ
独厮守ぢ 2020-11-29 07:30

I have two Date objects with the below format.

SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd\'T\'HH:mm:ss\");
String         


        
6条回答
  •  被撕碎了的回忆
    2020-11-29 07:58

    An Alternative is....

    Convert both dates into milliseconds as below

    Date d = new Date();
    long l = d.getTime();
    

    Now compare both long values

提交回复
热议问题