Package org.cdk8s

Class 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.

    • Constructor Detail

      • Duration

        protected Duration​(software.amazon.jsii.JsiiObjectRef objRef)
      • Duration

        protected Duration​(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • 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 the Duration will represent. This parameter is required.
        Returns:
        a new Duration representing amount 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 the Duration will represent. This parameter is required.
        Returns:
        a new Duration representing amount 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 the Duration will represent. This parameter is required.
        Returns:
        a new Duration representing amount 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 the Duration will represent. This parameter is required.
        Returns:
        a new Duration representing amount 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 the Duration will represent. This parameter is required.
        Returns:
        a new Duration representing amount 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.
      • 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.