/**
 *
 */
package com.shigeharu.date.format;

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

/**
 *
 * @author shigeharu
 *
 */
public class TestDateTimeFormatter {
	private final static DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ofPattern("HH:mm:ss n");
	/**
	 *
	 * @param args
	 */
	public static void main(String[] args) throws InterruptedException {

		/** 過ごした時間計算(ナノ秒も計算) */
		/* 開始時刻 */
		LocalTime startIime = LocalTime.now();
		System.out.println(LocalTime.now().format(TIME_FORMAT));
		Thread.sleep(2000);
		/* 終了時刻 */
		LocalTime endTime = LocalTime.now();
		System.out.println(endTime.format(TIME_FORMAT));
		Duration dura1 = Duration.between(startIime, endTime);
		long seconds = dura1.getSeconds();
		int nano = dura1.getNano();
		/* 経過した時間 */
		System.out.println(String.format("%02d:%02d:%02d %09d", seconds / 3600,
				(seconds % 3600) / 60, seconds % 60, nano));

	}

}

@@ -510,16 +510,26 @@
 println(
+%22%E9%96%8B%E5%A7%8B%E6%99%82%E5%88%BB:%22 + 
 LocalTim
@@ -653,16 +653,26 @@
 println(
+%22%E7%B5%82%E4%BA%86%E6%99%82%E5%88%BB:%22 + 
 endTime.
@@ -868,16 +868,21 @@
 format(%22
+%E6%99%82%E9%96%93%E5%B7%AE%E3%80%80:
 %2502d:%2502

フォーマット修正 Signed-off-by: Nakajima Shigeharu <shigeharu_1978@yahoo.co.jp>