Edit This Code:
<!DOCTYPE html>
<html>
<body>

<form action="form_action.asp">
  Date: <input type="datetime" id="myDatetime" name="date" required>
  <input type="submit">
</form>

<p>Click the "Try it" button to find out if the datetime field must be filled out before submitting the form.</p>

<button onclick="myFunction()">Try it</button>

<p><strong>Note:</strong> input elements with type="datetime" do not show as any datetime field/calendar in any of the major browsers, except Safari.</p>

<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myDatetime").required;
    document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>


Result:
Try it Yourself - © w3schools.com