Skip to main content
Version: Java (Groovy)

nanosOfSecond

nanosOfSecond returns the number of nanoseconds that have elapsed since the top of the second for the specified date-time.

Syntax

nanosOfSecond(dateTime, timeZone)

Parameters

ParameterTypeDescription
instantInstant

The date-time from which to return the number of nanoseconds.

timeZoneZoneId

The time zone.

dateTimeZonedDateTime

The date-time from which to return the number of nanoseconds.

Returns

The specified date-time converted into nanoseconds. Null input values will return NULL_LONG.

Examples

datetime = parseInstant("2022-03-01T12:34:56 ET")

nanos = nanosOfSecond(datetime, timeZone("ET"))

println nanos