Android 判断给定字符串时间是否为今日

/**
    * 判断给定字符串时间是否为今日
    *
    * @param sdate
    * @return boolean
    */
   public static boolean isToday(String sdate) {
       boolean b = false;
       Date time = toDate(sdate);
       Date today = new Date();
       if (time != null) {
           String nowDate = dateFormater2.get().format(today);
           String timeDate = dateFormater2.get().format(time);
           if (nowDate.equals(timeDate)) {
               b = true;
           }
       }
       return b;
   }

 

你可能感兴趣的:(Android 判断给定字符串时间是否为今日)