You are here: Reference > JavaScript > client-side > HTML DOM > properties > dateTime

dateTime property

Browser support:
Sets or retrieves the timestamp when a deletion or insertion was made.
This is merely an information property for the author, it does not have any functionality.

Syntax:

object.dateTime;
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: dateTime

Possible values:

String that sets or retrieves the date and time in the following format: YYYY-MM-DDThh:mm:ssTZD. (1977-01-07T08:06:45+06:00)
YYYY
four-digit year
MM
month (two digits: 01=January, etc.)
DD
day (two digits: 01 through 31)
hh
hour (two digits: 00 through 23) (am/pm NOT allowed)
mm
minute (two digits: 00 through 59)
ss
second (two digits: 00 through 59)
TZD
time zone designator. 'Z' - specifies UTC (Coordinated Universal Time) or +/-hh:mm (hour:minute 04:36) specified ahead/behind UTC.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the dateTime attribute:
<ins datetime="2006-01-12T08:00:00Z">one</ins> year old standard.
<ins datetime="2001-01-07T08:06:45+06:00">six</ins> years old standard.
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the dateTime property:
<head>
    <script type="text/javascript">
        function GetDateTime () {
            var insTags = document.getElementsByTagName ("ins");

            for (var i = 0; i < insTags.length; i++) {
                alert ("The dateTime property of the " + (i+1) + ". ins tag: " + insTags[i].dateTime);
            }
        }
    </script>
</head>
<body>
    <ins datetime="2006-01-12T08:00:00Z">one</ins> year old standard.
    <ins datetime="2001-01-07T08:06:45+06:00">six</ins> years old standard.

    <button onclick="GetDateTime ();">Get dateTime!</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

External links:

User Contributed Comments

Post Content

Post Content