Latest web development tutorials
 

ins dateTime Property

< ins Object

Example

Return the date and time of when some text was inserted:

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

The result of x could be:

2012-09-15T22:55:03Z
Try it Yourself »

Definition and Usage

The dateTime property sets or returns the value of the datetime attribute of an inserted text.

The datetime attribute specifies the date and time of when the text was inserted/changed.

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


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The dateTime property is supported in all major browsers.


Syntax

Return the dateTime property:

insObject.dateTime

Set the dateTime property:

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

Property Values

Value Description
YYYY-MM-DDThh:mm:ssTZD Specifies the date and time of when the text was inserted/changed.

Explanation of components:

  • YYYY - year (e.g. 2009)
  • MM - month (e.g. 01 for January)
  • DD - day of the month (e.g. 08)
  • T - a required separator
  • hh - hour (e.g. 22 for 10.00pm)
  • mm - minutes (e.g. 55)
  • ss - seconds (e.g. 03)
  • TZD - Time Zone Designator (Z denotes Zulu, also known as Greenwich Mean Time)

Technical Details

Return Value: A String, representing the date and time of when the text was inserted

More Examples

Example

Change the value of the datetime attribute:

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

Related Pages

HTML reference: HTML <ins> datetime attribute


< ins Object