一天24小时五分钟时间点

阅读更多

public static void main(String[] args) throws ParseException {

List times = new ArrayList();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        SimpleDateFormat OutSdf = new
    SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
String yearsTime = "20180201";
for (int j = 0; j < 24; j++) {
String hourTime = yearsTime + String.format("%1$02d", j);
String startingTime = "00";
times.add(hourTime + startingTime);
for (int i = 0; i < 12; i++) {

Integer t = new Integer(500 *i);
String timeDate = t.toString();
if(Integer.parseInt(timeDate) < 500){
timeDate ="000" + timeDate;
}else if(Integer.parseInt(timeDate) < 1000){
timeDate ="0" + timeDate;
}
String time = hourTime  + timeDate;
//System.out.println(time);
    System.out.println(OutSdf.format(sdf.parse(time)));
times.add(time) ;
}
//System.out.println("---------------一小时已过 =--- ");
}
//System.out.println(times.size());


}

你可能感兴趣的:(一天24小时五分钟时间点)