Java 获取距离最近一段时间的时间点

        if (timeFilter == 1) {// 最近三个月
            long curTimeSeconds = System.currentTimeMillis() / 1000L;
            para.put("startTime", curTimeSeconds - 3L * 30 * 24 * 60 * 60);
            para.put("endTime", curTimeSeconds);
        } else if (timeFilter == 2) {// 今年内
            Calendar ca = Calendar.getInstance();
            ca.set(ca.get(Calendar.YEAR), 0, 1, 0, 0, 0);
            para.put("startTime", ca.getTimeInMillis() / 1000L);
            para.put("endTime", System.currentTimeMillis() / 1000L);
        }

 

posted @ 2015-08-17 15:16  March On  阅读(1962)  评论(0编辑  收藏  举报
top last
Welcome user from
(since 2020.6.1)