Skip to main content
Version: Java (Groovy)

nanosOfDay

nanosOfDay returns the number of nanoseconds that have elapsed since the top of the day (midnight) for the specified date-time.

Syntax

nanosOfDay(dateTime, timeZone, localTime)
nanosOfDay(dateTime, localTime)
nanosOfDay(lotalTime)

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.

localTimeboolean

Set this parameter to false if you need Deephaven to account for daylight savings time.

  • If false, returns the number of nanoseconds from the start of the day. However, on days when daylight savings time events occur, results may be different from what is expected based on the local time. For example, on DST change days, 9:30 AM may be earlier or later in the day based on whether the daylight savings time adjustment is forward or backward. On non-DST days, the result is the same as if localTime is false.
  • If true, returns the number of nanoseconds from the start of the day according to the local time. In this case, 9:30 will always return the same value.

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 = nanosOfDay(datetime, timeZone("ET"), false)

println nanos