Class Time


@Bean(typeName="time") public class Time extends HtmlElementMixed
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: