- java.time Package Classes
- java.time - Home
- java.time - Clock
- java.time - Duration
- java.time - Instant
- java.time - LocalDate
- java.time - LocalDateTime
- java.time - LocalTime
- java.time - MonthDay
- java.time - OffsetDateTime
- java.time - OffsetTime
- java.time - Period
- java.time - Year
- java.time - YearMonth
- java.time - ZonedDateTime
- java.time - ZoneId
- java.time - ZoneOffset
- java.time Package Enums
- java.time - Month
- java.time Useful Resources
- java.time - Discussion
java.time.LocalTime.toNanoOfDay() Method Example
Description
The java.time.LocalTime.toNanoOfDay() method extracts the time as nanos of day, from 0 to 24 * 60 * 60 * 1,000,000,000 - 1.
Declaration
Following is the declaration for java.time.LocalTime.toNanoOfDay() method.
public long toNanoOfDay()
Return Value
the nano of day equivalent to this time.
Example
The following example shows the usage of java.time.LocalTime.toNanoOfDay() method.
package com.tutorialspoint; import java.time.LocalTime; public class LocalTimeDemo { public static void main(String[] args) { LocalTime time = LocalTime.now(); System.out.println(time.toNanoOfDay()); } }
Let us compile and run the above program, this will produce the following result −
52646592000000
Advertisements
To Continue Learning Please Login
Login with Google