You are here: Reference > JavaScript > client-side > HTML DOM > properties > lastModified (document, XMLDocument)

lastModified property (document, XMLDocument)

Browser support:
Retrieves the date and time when the document was last modified.
In case of HTML documents, the fileCreatedDate, fileModifiedDate, fileUpdatedDate and fileSize properties provide further information about the file in Internet Explorer.


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

String that represents the date and time. You can use this value in the constructor of the Date object.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the lastModified property:
    <script type="text/javascript">
        function GetFileInfo () {
            var message = "";
            if (document.fileCreatedDate) {
                message += "The document file was created at: <b>" + document.fileCreatedDate + "</b><br />";
            if (document.fileModifiedDate) {
                message += "The document file was last modified at: <b>" + document.fileModifiedDate + "</b><br />";
            if (document.lastModified) {
                message += "The document file was last modified at: <b>" + document.lastModified + "</b><br />";
            if (document.fileUpdatedDate) {
                message += "The document file was last updated at: <b>" + document.fileUpdatedDate + "</b><br />";
            if (document.fileSize) {
                message += "The size of the document file is: <b>" + document.fileSize + " bytes</b><br />";
            var info = document.getElementById ("info");
            info.innerHTML = message;
<body onload="GetFileInfo ();">
    <div id="info" style="width:500px; overflow:auto; background-color:#e0d0d0;"></div>
Did you find this example helpful? yes no

Supported by objects:

External links:

User Contributed Comments

Post Content

Post Content