- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set date and time when the text was deleted using HTML?
When working with HTML to create a web content, it is common to make changes to text and remove old or wrong information. It is important to keep the content up-to-date, while it is also important to keep a record of when changes are made. In HTML, setting the date and time when the text was deleted is a simple process.
Syntax
<del datetime=” ”>content…. </del>
Here is a datetime attribute in the del element, which specifies the date and time when the text was deleted.
Using the Del Element in HTML
We use <del> tag, to delete a text in HTML. This tag mark strike on the text which is to be delete from the document. for example −
<p>We are using <del datetime="2011-01-05T08:15:30-05:00">CSS</del> <ins datetime="2011-01-05T08:15:30-05:00">CSS 3</ins> for web development.</p>
Here, we have set the "datetime" attribute in the del element, which specifies the content of the time when the text was deleted.
Example
Here is an example of how to set date and time when the text was deleted using HTML.
<!DOCTYPE html> <html> <head> <style> body{ text-align: center; } </style> </head> <body> <h3>This is an example of how to use the del element to<br> specify the date and time when the text was deleted</h3> <p>We are using <del datetime="2011-01-05T08:15:30-05:00">CSS</del> <ins datetime="2011-01-05T08:15:30-05:00">CSS 3</ins> for web development.</p> </body> </html>
Using the Time Element in HTML
In HTML, the time element is used to represent a specific date and time. It is used to display timestamps for various types of events on a webpage, including when text was deleted. By using the time element for the deleted text, we can add a timestamp for when the text was deleted. For example −
<p>This text will be deleted : <time datetime="2023-03-25T09:00:00Z">March 25, 2023 at 9:00am UTC</time></p>
Here, the text "This text will be deleted:" is followed by the time element. We have set the "datetime" attribute in the time element, which specifies the content of the time when the text was deleted. The text content of the Time element displays the date and time in a readable format.
Example
Here is an example of how to use the Time element to add a timestamp for deleted text.
<!DOCTYPE html> <html> <head> <style> body{ text-align: center; } </style> </head> <body> <h3>This is an example of how to use the Time element to<br> add a timestamp for deleted text</h3> <p>This text will be deleted: <time datetime="2023-03-25T09:00:00Z">March 25, 2023 at 9:00am UTC</time></p> </body> </html>
Conclusion
Here, we discussed how to set the date and time when the text was deleted using HTML. In HTML, Setting the date and time when the text was deleted is a simple process by using the del element and time element.