pub struct Time;Expand description
The <time> element - date and/or time.
§Purpose
The <time> element represents a specific time or date, optionally with a
machine-readable timestamp in the datetime attribute. It helps search engines
and other software understand temporal information.
§Content Categories
- Flow Content
- Phrasing Content
- Palpable Content
§Permitted Content Model
- Phrasing content (but no
<time>descendants)
§Common Use Cases
- Publication dates
- Event dates and times
- Deadlines and schedules
- Historical dates
- Time-based content
§Key Attributes
datetime: Machine-readable date/time (ISO 8601 format)- Global attributes
§Example
<p>Posted on <time datetime="2024-01-15">January 15, 2024</time></p>
<p>Event starts at <time datetime="2024-06-20T19:00">7:00 PM on June 20</time></p>
<p>Updated <time datetime="2024-01-15T14:30:00Z">today at 2:30 PM</time></p>
<time datetime="2024">2024</time>§Accessibility
- Provides semantic meaning for dates and times
datetimeattribute aids machine parsing
§WHATWG Specification
Trait Implementations§
Source§impl HtmlElement for Time
impl HtmlElement for Time
impl<T: PhrasingContent> CanContain<T> for Time
impl CanContain<Text> for Time
impl FlowContent for Time
impl PalpableContent for Time
impl PhrasingContent for Time
Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more