How to get current date in JavaScript?

Easy to use new Date() to get a current Date to new Date object containing the current date and time.

<!DOCTYPE html>
<html>
<body>

<h2>First JavaScript Tutorial</h2>

<button type="button" onclick="document.getElementById('test').innerHTML = new Date();">
Click me.</button>

<p id="test"></p>

</body>
</html>

No comments:

Post a Comment

how to call ssh from vs code

 To call SSH from VS Code, you can use the built-in Remote Development extension. This extension allows you to open a remote folder or works...