Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

ins dateTime property

ins dateTime property

ins Object Reference ins Object

Example

Return the date and time when the text was inserted:

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

x The output result is:

2012-09-15T22:55:03Z

Try it »


Definition and usage

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

The datetime attribute defines the date and time when the text was inserted or modified.

Note: The dateTime property has no visual effect in ordinary web browsers but can be used by screen readers.


Browser support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the dateTime property.


Syntax

Return the dateTime property:

insObject

.dateTime

Set the dateTime property:

insObject

.dateTime=

YYYY-MM-DDThh:mm:ssTZD

Attribute values

Value Description
YYYY-MM-DDThh:mm:ssTZD

Date or time. The components are explained below:

  • YYYY - Year (e.g. 2011)
  • MM - Month (e.g. 01 for January)
  • DD - Day (e.g. 08)
  • T - Required separator if the time is specified
  • hh - Hour (e.g. 22 for 10.00pm)
  • mm - Minute (e.g. 55)
  • ss - Second (e.g. 03)
  • TZD - Time zone designator (Z stands for Zulu, also known as Greenwich Mean Time)
  • |

    Technical description

    Return value: String, representing the date and time of the inserted text

    More examples

    Example

    Modify the datetime attribute value:

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

    Try it »

    Related Articles

    HTML Reference Manual: HTML datetime property


    ins Object Reference ins Object