@Generated(value="jsii-pacmak/1.1.0 (build df55f5e)", date="2020-04-07T12:30:21.746Z") @Stability(value=Stable) 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)
Create a Duration representing an amount of days.
|
static Duration |
hours(Number amount)
Create a Duration representing an amount of hours.
|
static Duration |
millis(Number amount)
Create a Duration representing an amount of milliseconds.
|
static Duration |
minutes(Number amount)
Create a Duration representing an amount of minutes.
|
static Duration |
parse(String duration)
Parse a period formatted according to the ISO 8601 standard.
|
static Duration |
seconds(Number amount)
Create a Duration representing an amount of seconds.
|
Number |
toDays()
Return the total number of days in this Duration.
|
Number |
toDays(TimeConversionOptions opts)
Return the total number of days in this Duration.
|
Number |
toHours()
Return the total number of hours in this Duration.
|
Number |
toHours(TimeConversionOptions opts)
Return the total number of hours in this Duration.
|
String |
toHumanString()
Turn this duration into a human-readable string.
|
String |
toIsoString()
Return an ISO 8601 representation of this period.
|
String |
toISOString()
Deprecated.
Use `toIsoString()` instead.
|
Number |
toMilliseconds()
Return the total number of milliseconds in this Duration.
|
Number |
toMilliseconds(TimeConversionOptions opts)
Return the total number of milliseconds in this Duration.
|
Number |
toMinutes()
Return the total number of minutes in this Duration.
|
Number |
toMinutes(TimeConversionOptions opts)
Return the total number of minutes in this Duration.
|
Number |
toSeconds()
Return the total number of seconds in this Duration.
|
Number |
toSeconds(TimeConversionOptions opts)
Return the total number of seconds in this Duration.
|
String |
toString()
Returns a string representation of this `Duration` that is also a Token that cannot be successfully resolved.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet
protected Duration(software.amazon.jsii.JsiiObjectRef objRef)
protected Duration(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable) @NotNull public static Duration days(@NotNull Number amount)
amount
- the amount of Days the `Duration` will represent. This parameter is required.@Stability(value=Stable) @NotNull public static Duration hours(@NotNull Number amount)
amount
- the amount of Hours the `Duration` will represent. This parameter is required.@Stability(value=Stable) @NotNull public static Duration millis(@NotNull Number amount)
amount
- the amount of Milliseconds the `Duration` will represent. This parameter is required.@Stability(value=Stable) @NotNull public static Duration minutes(@NotNull Number amount)
amount
- the amount of Minutes the `Duration` will represent. This parameter is required.@Stability(value=Stable) @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=Stable) @NotNull public static Duration seconds(@NotNull Number amount)
amount
- the amount of Seconds the `Duration` will represent. This parameter is required.@Stability(value=Stable) @NotNull public Number toDays(@Nullable TimeConversionOptions opts)
opts
- @Stability(value=Stable) @NotNull public Number toDays()
@Stability(value=Stable) @NotNull public Number toHours(@Nullable TimeConversionOptions opts)
opts
- @Stability(value=Stable) @NotNull public Number toHours()
@Stability(value=Stable) @NotNull public String toHumanString()
@Stability(value=Stable) @NotNull public String toIsoString()
https://www.iso.org/fr/standard/70907.html
@Stability(value=Deprecated) @Deprecated @NotNull public String toISOString()
https://www.iso.org/fr/standard/70907.html
@Stability(value=Stable) @NotNull public Number toMilliseconds(@Nullable TimeConversionOptions opts)
opts
- @Stability(value=Stable) @NotNull public Number toMilliseconds()
@Stability(value=Stable) @NotNull public Number toMinutes(@Nullable TimeConversionOptions opts)
opts
- @Stability(value=Stable) @NotNull public Number toMinutes()
@Stability(value=Stable) @NotNull public Number toSeconds(@Nullable TimeConversionOptions opts)
opts
- @Stability(value=Stable) @NotNull public Number toSeconds()
@Stability(value=Stable) @NotNull public String toString()
This
protects users against inadvertently stringifying a Duration
object, when they should have called one of the
to*
methods instead.
Copyright © 2020. All rights reserved.