Monday, 27 May 2013

How to check current date and time using Javascript

<html>
<head>
<title>Today's Date</title>
    <script LANGUAGE="JavaScript">
    // Define a function for use later on.
    function todays_date()
    {
        var d = new Date();  // today's date and time.
        document.write(d.toLocaleString());
    }
    </script>
</head>
<body>
<hr>The date and time are:<hr><b>
    <script LANGUAGE="JavaScript">
    // now call the function we defined above
    todays_date();
    </script>
</b><hr>
</body>
</html>

No comments:

Post a Comment