How to get Date object in “YYYY-MM-DD” format in android

后端 未结 5 1533
借酒劲吻你
借酒劲吻你 2021-02-18 20:04

I have a requirement that I need to compare two Dates. One Date will come from DB which is String in \"YYYY-DD-MM\" firm and I need to compare this String Date with current Date

5条回答
  •  南笙
    南笙 (楼主)
    2021-02-18 20:36

     Date cDate = new Date();
     String fDate = new SimpleDateFormat("yyyy-MM-dd").format(cDate);
    

提交回复
热议问题