@Generated(value="jsii-pacmak/1.30.0 (build adae23f)", date="2021-06-30T10:00:42.458Z") @Stability(value=Experimental) public class Duration extends software.amazon.jsii.JsiiObject
The amount can be specified either as a literal value (e.g: 10) which
cannot be negative, or as an unresolved number token.
When the amount is passed as a token, unit conversion is not possible.
| Modifier | Constructor and Description |
|---|---|
protected |
Duration(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Duration(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
static Duration |
days(Number amount)
(experimental) Create a Duration representing an amount of days.
|
String |
formatTokenToNumber()
(experimental) Returns stringified number of duration.
|
static Duration |
hours(Number amount)
(experimental) Create a Duration representing an amount of hours.
|
Boolean |
isUnresolved()
(experimental) Checks if duration is a token or a resolvable object.
|
static Duration |
millis(Number amount)
(experimental) Create a Duration representing an amount of milliseconds.
|
static Duration |
minutes(Number amount)
(experimental) Create a Duration representing an amount of minutes.
|
static Duration |
parse(String duration)
(experimental) Parse a period formatted according to the ISO 8601 standard.
|
Duration |
plus(Duration rhs)
(experimental) Add two Durations together.
|
static Duration |
seconds(Number amount)
(experimental) Create a Duration representing an amount of seconds.
|
Number |
toDays()
(experimental) Return the total number of days in this Duration.
|
Number |
toDays(TimeConversionOptions opts)
(experimental) Return the total number of days in this Duration.
|
Number |
toHours()
(experimental) Return the total number of hours in this Duration.
|
Number |
toHours(TimeConversionOptions opts)
(experimental) Return the total number of hours in this Duration.
|
String |
toHumanString()
(experimental) Turn this duration into a human-readable string.
|
String |
toIsoString()
(experimental) Return an ISO 8601 representation of this period.
|
Number |
toMilliseconds()
(experimental) Return the total number of milliseconds in this Duration.
|
Number |
toMilliseconds(TimeConversionOptions opts)
(experimental) Return the total number of milliseconds in this Duration.
|
Number |
toMinutes()
(experimental) Return the total number of minutes in this Duration.
|
Number |
toMinutes(TimeConversionOptions opts)
(experimental) Return the total number of minutes in this Duration.
|
Number |
toSeconds()
(experimental) Return the total number of seconds in this Duration.
|
Number |
toSeconds(TimeConversionOptions opts)
(experimental) Return the total number of seconds in this Duration.
|
String |
toString()
(experimental) Returns a string representation of this `Duration` that is also a Token that cannot be successfully resolved.
|
String |
unitLabel()
(experimental) Returns unit of the duration.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected Duration(software.amazon.jsii.JsiiObjectRef objRef)
protected Duration(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Experimental) @NotNull public static Duration days(@NotNull Number amount)
amount - the amount of Days the `Duration` will represent. This parameter is required.@Stability(value=Experimental) @NotNull public static Duration hours(@NotNull Number amount)
amount - the amount of Hours the `Duration` will represent. This parameter is required.@Stability(value=Experimental) @NotNull public static Duration millis(@NotNull Number amount)
amount - the amount of Milliseconds the `Duration` will represent. This parameter is required.@Stability(value=Experimental) @NotNull public static Duration minutes(@NotNull Number amount)
amount - the amount of Minutes the `Duration` will represent. This parameter is required.@Stability(value=Experimental) @NotNull public static Duration parse(@NotNull String duration)
duration - an ISO-formtted duration to be parsed. This parameter is required.https://www.iso.org/fr/standard/70907.html@Stability(value=Experimental) @NotNull public static Duration seconds(@NotNull Number amount)
amount - the amount of Seconds the `Duration` will represent. This parameter is required.@Stability(value=Experimental) @NotNull public String formatTokenToNumber()
@Stability(value=Experimental) @NotNull public Boolean isUnresolved()
@Stability(value=Experimental) @NotNull public Duration plus(@NotNull Duration rhs)
rhs - This parameter is required.@Stability(value=Experimental) @NotNull public Number toDays(@Nullable TimeConversionOptions opts)
opts - @Stability(value=Experimental) @NotNull public Number toDays()
@Stability(value=Experimental) @NotNull public Number toHours(@Nullable TimeConversionOptions opts)
opts - @Stability(value=Experimental) @NotNull public Number toHours()
@Stability(value=Experimental) @NotNull public String toHumanString()
@Stability(value=Experimental) @NotNull public String toIsoString()
https://www.iso.org/fr/standard/70907.html@Stability(value=Experimental) @NotNull public Number toMilliseconds(@Nullable TimeConversionOptions opts)
opts - @Stability(value=Experimental) @NotNull public Number toMilliseconds()
@Stability(value=Experimental) @NotNull public Number toMinutes(@Nullable TimeConversionOptions opts)
opts - @Stability(value=Experimental) @NotNull public Number toMinutes()
@Stability(value=Experimental) @NotNull public Number toSeconds(@Nullable TimeConversionOptions opts)
opts - @Stability(value=Experimental) @NotNull public Number toSeconds()
@Stability(value=Experimental) @NotNull public String toString()
This
protects users against inadvertently stringifying a Duration object, when they should have called one of the
to* methods instead.
@Stability(value=Experimental) @NotNull public String unitLabel()
Copyright © 2021. All rights reserved.