does anybody know of a javascript to display the time dynamically as a UNIX Timestamp?
I've had a google but haven't had much luck
cheers,
Mitchel
My googlefoo is stronger than yours young grasshopper
http://www.epochconverter.com/
Scroll down to see the code snippet. You can also have a look through the page javascript to see how the animated clock works![]()
came across this earlier, a few times even. only thing I can't seem to find is how to display it. using document.write() just writes it over and over again
You're making a really geeky valentines day card, aren't you?
<html>
<head>
<script type="text/javascript">
function timeSecs()
{
var currentTime = new Date();
var secs = currentTime.getTime();
var secs = secs + "";
var secs = secs.substring(0,10);
document.getElementById('time').value=secs;
setTimeout("timeSecs()",1000);
}
</script>
</head>
<body onload="timeSecs()">
<form>
<input type="text" id="time">
</form>
</body>
</html>
This is what I put together yesterday.
PHP:<html> <head> <script type="text/javascript"> function timeSecs() { var currentTime = new Date(); var secs = currentTime.getTime(); var secs = secs + ""; var secs = secs.substring(0,10); document.getElementById('time').value=secs; setTimeout("timeSecs()",1000); } </script> </head> <body onload="timeSecs()"> <form> <input type="text" id="time"> </form> </body> </html>