जावास्क्रिप्ट में दिनांक वस्तु को क्लोन करने के लिए, आप निम्न कोड को चलाने का प्रयास कर सकते हैं। यहां, हमने वर्तमान तिथि का क्लोन बनाया है:
उदाहरण
<html>
<head>
<title>JavaScript Clone Date</title>
</head>
<body>
<script>
var current_date, clonedDate;
current_date = new Date();
document.write(current_date);
var clonedDate = new Date(current_date.getTime());
document.write("<br>"+clonedDate);
</script>
</body>
</html> आउटपुट
Mon May 28 2018 09:27:54 GMT+0530 (India Standard Time) Mon May 28 2018 09:27:54 GMT+0530 (India Standard Time)