java8 LocalTime DateTimeFormatter 时间加秒 时间间隔 时间加几秒

java8 LocalTime DateTimeFormatter 时间加秒 时间间隔 时间加几秒

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

public class TestZD {
	
	public static String localIimeFormatter(LocalTime localTime, DateTimeFormatter dateTimeFormatter) {
		return localTime.format(dateTimeFormatter);
	}

	public static void main(String[] args) {
		LocalTime localTime = LocalTime.of(0, 0, 0);
		for (int i = 0; i < 10; i++) {
			System.out.println(TestZD.localIimeFormatter(localTime, DateTimeFormatter.ofPattern("HH:mm:ss")));
			localTime = localTime.plusSeconds(70L);
		}

	}

}
00:00:00
00:01:10
00:02:20
00:03:30
00:04:40
00:05:50
00:07:00
00:08:10
00:09:20
00:10:30

 

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 代码科技 设计师:Amelia_0503 返回首页