ins dateTime attribute

Definition and Usage

dateTime Attribute sets or returns the value of the datetime attribute of the inserted text.

<ins> datetime attribute Specify the date and time of insertion/alteration of text.

Note:The datetime attribute has no visual effect in ordinary web browsers, but it can be used by screen readers.

See also:

HTML Reference Manual:HTML <ins> Tag

Instance

Example 1

Return the date and time of inserted text:

var x = document.getElementById("myIns").dateTime;

Try It Yourself

Example 2

Change the value of datetime attribute:

document.getElementById("myIns").dateTime = "2013-11-15T21:40:07Z";

Try It Yourself

Syntax

Return dateTime attribute:

insObject.dateTime

Set dateTime attribute:

insObject.dateTime = YYYY-MM-DDThh:mm:ssTZD

Attribute Value

Value Description
YYYY-MM-DDThh:mm:ssTZD

Specify the date and time of insertion/alteration of text.

Component Description:

  • YYYY - Year (for example, 2022)
  • MM - Month (for example, 06 represents January)
  • DD - Day of the month (for example, 18)
  • T - Required delimiter
  • hh - Hour (for example, 22 represents 10 PM)
  • mm - Minutes (e.g., 55)
  • ss - Seconds (e.g., 03)
  • TZD - Time Zone Indicator (Z represents Zulu, also known as Greenwich Mean Time)

Technical Details

Return Value: A string value representing the date and time of the inserted text.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Related Pages

HTML Reference Manual:HTML <ins> datetime Attribute