Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

The `<time>` Element – Machine‑readable | HTML Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. HTML Course

Lesson 48 of 55

·HTML

The `<time>` Element – Machine‑readable Dates & Times

8 min

Course progress87%

What you'll learn

Keep these ideas in mind as you work through the lesson.

5 points
  • Marking up dates, times, and durations with the `datetime` attribute
  • Human‑friendly display vs. ISO format for machines
  • Use cases: article timestamps, event dates, video durations
  • SEO benefits of machine‑readable dates
  • Avoiding deprecated `pubdate` in favor of structured data

The <time> Element – Semantic Dates & Times

<time> marks dates, times, or durations in a machine‑readable format.

<p>Event starts on <time datetime='2026-09-15T19:30' pubdate>September 15, 2026 at 7:30 PM</time>.</p>
<p>The conference lasted <time datetime='PT8H'>8 hours</time>.</p>

Attributes

  • datetime – ISO 8601 string that browsers and search engines can parse.
  • pubdate – Legacy attribute indicating a publication date; modern SEO prefers structured data instead.
  • title – Optional tooltip for human readers.

Use cases

  • Blog post timestamps for SEO and readability.
  • Event dates for rich snippets (Event schema).
  • Durations (PT5M for five minutes) for podcasts or video length.
  • Micro‑blogging with RFC 3339 compliant dates.

Quick checklist for <time>

  1. datetime attribute present and ISO‑8601 compliant? ✅
  2. Human‑readable text provided inside the element? ✅
  3. Used for publish dates, event dates, or durations? ✅
  4. No reliance on pubdate alone for SEO (use JSON‑LD instead)? ✅
  5. Tested with search engine structured‑data tools? ✅

Tip: When publishing news articles, combine <time> with JSON‑LD Article schema for maximum SEO benefit.

Make it stickPractice what you've learned1 quiz · 2 practical tests · Optional activities from HTML CourseBrowse activities
Previous lessonThe `<track>` Element – Subtitles and CaptionsContinue to lesson 49Custom Data Attributes – `data-*`Back to HTML Course curriculum