HTML DOM ins dateTime प्रॉपर्टी टेक्स्ट डालने की तारीख और समय लौटाती है।
सिंटैक्स
निम्नलिखित वाक्य रचना है -
रिटर्निंग स्ट्रिंग मान
insObject.dateTime
उदाहरण
आइए इन्स dateTime . के लिए एक उदाहरण देखें संपत्ति -
<!DOCTYPE html>
<html>
<head>
<title>ins dateTime</title>
<style>
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
}
</style>
</head>
<body>
<form>
<fieldset>
<legend>ins-dateTime</legend>
<h1>Fact:</h1>
<p>Water cannot persist on moon's surface.
<ins id="newInfo" cite="https://www.example.com/water-ice-moon-surface-confirmed.html" datetime="2018-08-21T18:23Z">
Water ice found on moon.</ins>
</p>
<input type="button" onclick="getDate()" value="When was this change made?">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var insDateTime = document.getElementById("newInfo");
function getDate() {
divDisplay.textContent = 'Text inserted on '+insDateTime.dateTime.split("T")[0];
divDisplay.textContent += ' at '+insDateTime.dateTime.split("T")[1];
}
</script>
</body>
</html> आउटपुट
यह निम्नलिखित आउटपुट उत्पन्न करेगा -
‘यह परिवर्तन कब किया गया था?’ . क्लिक करने से पहले बटन -

‘यह परिवर्तन कब किया गया था?’ . क्लिक करने के बाद बटन -
