HTML DOM Document lastModified attribute
- 上一页 inputEncoding
- 下一页 links
- 返回上一层 HTML DOM Documents
Definition and usage
lastModified
The property returns the date and time of the last modification of the document.
lastModified
The property is read-only.
Tip
The 'Try it yourself' instance always returns the current date/time because the document is created at runtime.
Instance
Example 1
Get the date and time of the last modification of the document:
let text = document.lastModified;
Example 2
Convert the lastModified attribute to a date object:
const date = new Date(document.lastModified);
Syntax
document.lastModified
Return value
Type | Description |
---|---|
String | The date and time of the last modification of the document. |
Browser supports
document.lastModified
是 DOM Level 3 (2004) 特性。
所有浏览器都支持它:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
支持 | 9-11 | 支持 | 支持 | 支持 | 支持 |
- 上一页 inputEncoding
- 下一页 links
- 返回上一层 HTML DOM Documents