How to get the time using Java script ?

Started by thiruvasagamani, Jul 31, 2008, 11:26 AM

Previous topic - Next topic

thiruvasagamani

Here is the sample code to get the current time

<html>
<body>

<script type="text/javascript">

var minutes = 1000*60;
var hours = minutes*60;
var days = hours*24;
var years = days*365;
var d = new Date();
var t = d.getTime();
var y = t/years;

document.write("It's been: " + y + " years since 1970/01/01!");

</script>

</body>
</html>
Thiruvasakamani Karnan