Enum TimestampFormat

    • Enum Constant Detail

      • DEFAULT

        public static final TimestampFormat DEFAULT
        Example: 20 April 2021 16:20
      • SHORT_TIME

        public static final TimestampFormat SHORT_TIME
        Example: 16:20
      • LONG_TIME

        public static final TimestampFormat LONG_TIME
        Example: 16:20:30
      • SHORT_DATE

        public static final TimestampFormat SHORT_DATE
        Example: 20/04/2021
      • LONG_DATE

        public static final TimestampFormat LONG_DATE
        Example: 20 April 2021
      • SHORT_DATE_TIME

        public static final TimestampFormat SHORT_DATE_TIME
        Example: 20 April 2021 16:20
      • LONG_DATE_TIME

        public static final TimestampFormat LONG_DATE_TIME
        Example: Tuesday, 20 April 2021 16:20
      • RELATIVE_TIME

        public static final TimestampFormat RELATIVE_TIME
        Example: 2 months ago
    • Method Detail

      • values

        public static TimestampFormat[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (TimestampFormat c : TimestampFormat.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static TimestampFormat valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getStyle

        public String getStyle()
        Get the style (1 character) for this timestamp format. The default format returns an empty string.
        Returns:
        The style character as a String
      • format

        public String format​(Instant instant)
        Gets the markdown representation of the provided Instant for this style. In a message, Discord will display the timestamp in the user's local timezone.
        Parameters:
        instant - the Instant to construct a timestamp with.
        Returns:
        The markdown representation of the Instant as a String.