Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <p>Change the date and time of the datetime field, and then click the button below.</p> <input type="datetime-local" id="myLocalDate" value="2014-11-16T15:25:33"> <p>Note that the default value is not affected when you change the value of the datetime field.</p> <button type="button" onclick="myFunction()">Try it</button> <p><strong>Note:</strong> input elements with type="datetime-local" are not supported in Internet Explorer or Firefox.</p> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myLocalDate"); var defaultVal = x.defaultValue; var currentVal = x.value; if (defaultVal == currentVal) { document.getElementById("demo").innerHTML = "Default value and current value is the same: " + x.defaultValue + " and " + x.value + "<br>Change the value of the datetime field to see the difference!"; } else { document.getElementById("demo").innerHTML = "The default value was: " + defaultVal + "<br>The new, current value is: " + currentVal; } } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_datetime-local_defaultvalue3 by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:32:42 GMT --> </html>
Result:
Try it Yourself - © w3schools.com