Example usage for java.time LocalTime toNanoOfDay

List of usage examples for java.time LocalTime toNanoOfDay

Introduction

In this page you can find the example usage for java.time LocalTime toNanoOfDay.

Prototype

public long toNanoOfDay() 

Source Link

Document

Extracts the time as nanos of day, from 0 to 24 * 60 * 60 * 1,000,000,000 - 1 .

Usage

From source file:Main.java

public static void main(String[] args) {
    LocalTime l = LocalTime.now();

    System.out.println(l.toNanoOfDay());
}

From source file:Main.java

public static void main(String[] args) {
    LocalTime time = LocalTime.of(15, 30, 23, 234); // 15:30:00
    System.out.println(time.getHour()); // 15
    System.out.println(time.getMinute()); // 30
    System.out.println(time.getSecond()); // 23
    System.out.println(time.getNano()); // 234
    System.out.println(time.toSecondOfDay()); // 55823
    System.out.println(time.toNanoOfDay()); // 55823000000234
}