Latest web development tutorials

ins dateTime property

ins Object Reference ins objects

Examples

Returns the date and time text is inserted:

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

x The output is:

2012-09-15T22:55:03Z

try it"

Definitions and use

dateTime property sets or returns to insert text datetime attribute values.

datetime attribute defines the date and time is inserted or modify the text.

Note: dateTime property has no visual effect in an ordinary web browser, but you can use screen readers.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support dateTime attribute.


grammar

Back dateTime attributes:

insObject .dateTime

Setting dateTime attributes:

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

Property Value

描述
YYYY-MM-DDThh:mm:ssTZD

日期或时间。下面解释了其中的成分:

  • YYYY - 年 (例如 2011)
  • MM - 月 (例如 01 表示 January)
  • DD - 天 (例如 08)
  • T - 必需的分隔符,若规定时间的话
  • hh - 时 (例如 22 表示 10.00pm)
  • mm - 分 (例如 55)
  • ss - 秒 (例如 03)
  • TZD - 时区标识符 (Z 表示祖鲁,也称为格林威治时间)

Technical Description

return value: String that represents a date and time to insert text


More examples

Examples

Modify datetime attribute values:

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

try it"

related articles

HTML Reference Manual: HTML <INS> datetime attribute


ins Object Reference ins objects