Friday, March 11, 2011

How to get current date in Javascript

Here is simple program that will show you how to get current system date in Javascript and display
on the page.
Date()
this the function which used to get the current date in the javascript.
<!--
<html>
<head>
<script type="text/javascript">
function displayDate()
{
document.getElementById("demo").innerHTML=Date();
}
</script>
</head>
<body>
<h1>My First Web Page</h1>
<p id="demo">This is a paragraph.</p>
<button type="button" onclick="displayDate()">Display Date</button>
</body>
</html>
-->

No comments :

Post a Comment