Class Time


@Marshalled(typeName="time") public class Time extends HtmlElementMixed<Time>
DTO for an HTML <time> element.

The time element represents a specific point in time or a duration. It provides a machine-readable way to mark up dates and times in HTML, making it easier for search engines, screen readers, and other tools to understand and process temporal information. The element can contain human-readable text while providing a machine-readable datetime attribute.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Simple date Time date = time("January 15, 2024") .datetime("2024-01-15"); // Date and time Time datetime = time("2:30 PM on January 15, 2024") .datetime("2024-01-15T14:30:00Z"); // Relative time Time relative = time("yesterday") .datetime("2024-01-15"); // Duration Time duration = time("2 hours and 30 minutes") .datetime("PT2H30M"); // Time with styling Time styled = time("Event Date: January 15, 2024") .datetime("2024-01-15") .class_("event-date"); // Time with timezone Time timezone = time("2:30 PM EST on January 15, 2024") .datetime("2024-01-15T14:30:00-05:00");

The following convenience methods are provided for constructing instances of this bean:

See Also:
  • Constructor Details

  • Method Details

    • datetime

      public Time datetime(String value)
      datetime attribute.

      Specifies the machine-readable value of the time element. This provides a standardized format for the date and time that can be processed by computers.

      The value should be a valid date-time string in ISO 8601 format.

      Parameters:
      value - The machine-readable date and time value. Can be null to unset the attribute.
      Returns:
      This object.