现在的位置: 首页 > 综合 > 正文

判断时间是否为今天

2018年08月27日 ⁄ 综合 ⁄ 共 269字 ⁄ 字号 评论关闭
    public static boolean isToday(long when) {
        Time time = new Time();
        time.set(when);

        int thenYear = time.year;
        int thenMonth = time.month;
        int thenMonthDay = time.monthDay;

        time.set(System.currentTimeMillis());
        return (thenYear == time.year)
                && (thenMonth == time.month)
                && (thenMonthDay == time.monthDay);
    }

【上篇】
【下篇】

抱歉!评论已关闭.