HTML Guide for time
The boolean required attribute can only be used with certain types of inputs. Check the input type is one of the allowed.
The required attribute, if present, indicates that the user must specify a value for the input before the owning form can be submitted.
The value used in the datetime attribute is not in a valid format.
The <time> HTML element represents a specific period in time. It may include the datetime attribute to translate dates into machine-readable format, allowing for better search engine results or custom features such as reminders.
The <time> HTML element represents a specific period in time, which can be taken from the datetime attribute or from the text contents of the element.
In both cases, the time or datetime must be in a valid format, for example:
- a valid year string
-
2011
- a valid month string
-
2011-11
- a valid date string
-
2011-11-18
- a valid yearless date string
-
11-18
- a valid week string
-
2011-W47
- a valid time string
-
14:54
14:54:39
14:54:39.929
- a valid local date and time string
-
2011-11-18T14:54:39.929
2011-11-18 14:54:39.929
- a valid global date and time string
-
2011-11-18T14:54:39.929Z
2011-11-18T14:54:39.929-0400
2011-11-18T14:54:39.929-04:00
2011-11-18 14:54:39.929Z
2011-11-18 14:54:39.929-0400
2011-11-18 14:54:39.929-04:00
- a valid duration string
-
PT4H18M3S
For example:
<p>
The event will take place on <time datetime="2025-03-20T13:00">March 20, 2025</time>.
</p>