Java 时间相比较

private String getRunTime() {
            String start = new Date.getTime();
                String end= new Date.getTime();
        long l = start  - end;        
        long day = l / (24 * 60 * 60 * 1000);
        long hour = (l / (60 * 60 * 1000) - day * 24);
        long min = ((l / (60 * 1000)) - day * 24 * 60 - hour * 60);
        long s = (l / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
        String str = day + " day " + hour + " hour " + min + " min " + s
                + " sec ";        
        return str;
    }

 

posted on 2013-09-04 14:37  张飞_  阅读(220)  评论(0编辑  收藏  举报

导航