Example usage for java.time LocalTime toSecondOfDay

List of usage examples for java.time LocalTime toSecondOfDay

Introduction

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

Prototype

public int toSecondOfDay() 

Source Link

Document

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

Usage

From source file:Main.java

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

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

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
}