How to add a date and time in HTML5?



Use the <time> tag to add date and time. The HTML <time> tag is used for displaying the human readable date and time.

The HTML <time> tag also supports the following additional attribute −

Attribute
Value
Description
datetime
datetime
It is a machine readable date time

Example

You can try to run the following code to learn how to add date and time <details> in HTML5 −

<!Doctype html> <html>    <head>       <title>HTML time Tag</title>    </head>    <body>       <p>The time is <time>08:30 pm</time></p>    </body> </html>
Updated on: 2020-03-02T12:23:18+05:30

4K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements