Package org.cdk8s
Class Duration
- java.lang.Object
-
- software.amazon.jsii.JsiiObject
-
- org.cdk8s.Duration
-
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-07-17T00:29:41.265Z") @Stability(Stable) public class Duration extends software.amazon.jsii.JsiiObject
Represents a length of time.The amount can be specified either as a literal value (e.g:
10
) which cannot be negative.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.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
unitLabel()
Return unit of Duration.-
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
-
-
-
-
Method Detail
-
days
@Stability(Stable) @NotNull public static Duration days(@NotNull Number amount)
Create a Duration representing an amount of days.- Parameters:
amount
- the amount of Days theDuration
will represent. This parameter is required.- Returns:
- a new
Duration
representingamount
Days.
-
hours
@Stability(Stable) @NotNull public static Duration hours(@NotNull Number amount)
Create a Duration representing an amount of hours.- Parameters:
amount
- the amount of Hours theDuration
will represent. This parameter is required.- Returns:
- a new
Duration
representingamount
Hours.
-
millis
@Stability(Stable) @NotNull public static Duration millis(@NotNull Number amount)
Create a Duration representing an amount of milliseconds.- Parameters:
amount
- the amount of Milliseconds theDuration
will represent. This parameter is required.- Returns:
- a new
Duration
representingamount
ms.
-
minutes
@Stability(Stable) @NotNull public static Duration minutes(@NotNull Number amount)
Create a Duration representing an amount of minutes.- Parameters:
amount
- the amount of Minutes theDuration
will represent. This parameter is required.- Returns:
- a new
Duration
representingamount
Minutes.
-
parse
@Stability(Stable) @NotNull public static Duration parse(@NotNull String duration)
Parse a period formatted according to the ISO 8601 standard.- Parameters:
duration
- an ISO-formtted duration to be parsed. This parameter is required.- Returns:
- the parsed
Duration
. - See Also:
- https://www.iso.org/fr/standard/70907.html
-
seconds
@Stability(Stable) @NotNull public static Duration seconds(@NotNull Number amount)
Create a Duration representing an amount of seconds.- Parameters:
amount
- the amount of Seconds theDuration
will represent. This parameter is required.- Returns:
- a new
Duration
representingamount
Seconds.
-
toDays
@Stability(Stable) @NotNull public Number toDays(@Nullable TimeConversionOptions opts)
Return the total number of days in this Duration.- Parameters:
opts
-- Returns:
- the value of this
Duration
expressed in Days.
-
toDays
@Stability(Stable) @NotNull public Number toDays()
Return the total number of days in this Duration.- Returns:
- the value of this
Duration
expressed in Days.
-
toHours
@Stability(Stable) @NotNull public Number toHours(@Nullable TimeConversionOptions opts)
Return the total number of hours in this Duration.- Parameters:
opts
-- Returns:
- the value of this
Duration
expressed in Hours.
-
toHours
@Stability(Stable) @NotNull public Number toHours()
Return the total number of hours in this Duration.- Returns:
- the value of this
Duration
expressed in Hours.
-
toHumanString
@Stability(Stable) @NotNull public String toHumanString()
Turn this duration into a human-readable string.
-
toIsoString
@Stability(Stable) @NotNull public String toIsoString()
Return an ISO 8601 representation of this period.- Returns:
- a string starting with 'PT' describing the period
- See Also:
- https://www.iso.org/fr/standard/70907.html
-
toMilliseconds
@Stability(Stable) @NotNull public Number toMilliseconds(@Nullable TimeConversionOptions opts)
Return the total number of milliseconds in this Duration.- Parameters:
opts
-- Returns:
- the value of this
Duration
expressed in Milliseconds.
-
toMilliseconds
@Stability(Stable) @NotNull public Number toMilliseconds()
Return the total number of milliseconds in this Duration.- Returns:
- the value of this
Duration
expressed in Milliseconds.
-
toMinutes
@Stability(Stable) @NotNull public Number toMinutes(@Nullable TimeConversionOptions opts)
Return the total number of minutes in this Duration.- Parameters:
opts
-- Returns:
- the value of this
Duration
expressed in Minutes.
-
toMinutes
@Stability(Stable) @NotNull public Number toMinutes()
Return the total number of minutes in this Duration.- Returns:
- the value of this
Duration
expressed in Minutes.
-
toSeconds
@Stability(Stable) @NotNull public Number toSeconds(@Nullable TimeConversionOptions opts)
Return the total number of seconds in this Duration.- Parameters:
opts
-- Returns:
- the value of this
Duration
expressed in Seconds.
-
toSeconds
@Stability(Stable) @NotNull public Number toSeconds()
Return the total number of seconds in this Duration.- Returns:
- the value of this
Duration
expressed in Seconds.
-
unitLabel
@Stability(Stable) @NotNull public String unitLabel()
Return unit of Duration.
-
-