首页 > 代码库 > [Java Code] 时间维度循环生成代码片段

[Java Code] 时间维度循环生成代码片段

public static void main(String[] args) throws ParseException {        String str = "20140301";        String str1 = "20140731";        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");        Calendar start = Calendar.getInstance();        Calendar end = Calendar.getInstance();        try {            start.setTime(format.parse(str));            end.setTime(format.parse(str1));        } catch (ParseException e) {            e.printStackTrace();        }        while (start.before(end)) {            System.out.println(format.format(start.getTime()));            start.add(Calendar.DAY_OF_MONTH, 1);        }    }

 

[Java Code] 时间维度循环生成代码片段