Skip to main content
Version: Java (Groovy)

microsOfSecond

microsOfSecond returns the number of microseconds that have elapsed since the top of the second.

Syntax

microsOfSecond(instant, timeZone)
microsOfMilli(dateTime)

Parameters

ParameterTypeDescription
instantInstant

The date-time from which to return the elapsed time.

timeZoneZoneId

The time zone.

dateTimeZonedDateTime

The date-time from which to return the elapsed time.

Returns

The number of microseconds that have elapsed since the start of the second represented by the provided date-time.

note

Microseconds are rounded, not dropped.

Examples

datetime = parseInstant("2023-09-09T12:34:56.123456 ET")

micros = microsOfSecond(datetime, timeZone("ET"))

println micros