Best way to compare dates in Android

  • 0
Best way to compare dates in Android

String str_date = "1/1/1990";
SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
Date date = sdf.parse(str_date);
if (new Date().after(date)) {
    catalog_outdated = 1;
}
or
SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
Date date = sdf.parse(str_date);if (System.currentTimeMillis() > date.getTime()) {    catalog_outdated = 1;
}

沒有留言 :

張貼留言