Skip to main content
Version: Java (Groovy)

parseDurationNanos

parseDurationNanos converts a string representing a Duration to nanoseconds.

Syntax

parseDurationNanos(s)

Parameters

ParameterTypeDescription
sstring

The string to be converted.

Time duration strings can be formatted as [-]PT[-]hh:mm:[ss.nnnnnnnnn] or as a Duration string formatted as [-]PnDTnHnMn.nS.

Returns

Nanoseconds representation of the time string.

Examples


one_day_nanos = parseDurationNanos("P1D")
one_hour_nanos = parseDurationNanos("PT1H")
println one_day_nanos
println one_hour_nanos