Example usage for java.time LocalTime getNano

List of usage examples for java.time LocalTime getNano

Introduction

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

Prototype

public int getNano() 

Source Link

Document

Gets the nano-of-second field.

Usage

From source file:Main.java

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

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

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
}

From source file:org.dozer.converters.LocalTimeConverter.java

@Override
public Object convert(Class destClass, Object srcObj) {
    LocalTime convertedValue = null;
    try {/*www . j av a 2 s .c  o  m*/
        if (srcObj instanceof String) {
            convertedValue = LocalTime.parse((String) srcObj);
        } else {
            LocalTime srcObject = (LocalTime) srcObj;
            convertedValue = LocalTime.of(srcObject.getHour(), srcObject.getMinute(), srcObject.getSecond(),
                    srcObject.getNano());
        }
    } catch (Exception e) {
        MappingUtils.throwMappingException("Cannot convert [" + srcObj + "] to LocalTime.", e);
    }
    return convertedValue;
}