Here is one, that can be used,
Code:
< !DOCTYPE HTML PUBLIC "- //W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd" >
<html> <head> <title> Days ago < /title >
<META NAME="Generator" CONTENT="Stone's WebWriter 3.5">
< ! -- Minus Auto Date -- >
< script type="text/javascript" >
< ! --
Date.ONE_SECOND = 1000;
Date.ONE_MINUTE = Date.ONE_SECOND * 60;
Date.ONE_HOUR = Date.ONE_MINUTE * 60;
Date.prototype.timeSince = function () (
var now = new Date ();
var d = new Date (this.getTime ());
var years = 0;
while (d.setFullYear (d.getFullYear () + 1) <now) (years + +);
d.setFullYear (d.getFullYear () - 1);
var months = 0;
while (d.setMonth (d.getMonth () + 1) <now) (months + +);
d.setMonth (d.getMonth () - 1);
var days = 0;
while (d.setDate (d.getDate () + 1) <now) (days + +);
d.setDate (d.getDate () - 1);
hours = Math.floor ((now - d) / Date.ONE_HOUR);
minutes = Math.floor ((now - d)% Date.ONE_HOUR / Date.ONE_MINUTE);
seconds = Math.floor ((now - d)% Date.ONE_MINUTE / Date.ONE_SECOND);
var a = new Array ();
if (years> 0) a.push ([years, years == 1? 'years':' years']. join ( ''));
if (month> 0) a.push ([months, months == 1? 'months':' months']. join ( ''));
if (days> 0) a.push ([days, days == 1? 'days':' days']. join ( ''));
if (hours> 0) a.push ([hours, hours == 1? 'hours':' hours']. join ( ''));
if (minutes> 0) a.push ([minutes, minutes == 1? 'minutes':' minutes']. join ( ''));
if (seconds> 0) a.push ([seconds, seconds == 1? 'seconds'' seconds']. join ( ''));
return a.join ( '');
)
// -->
< /script >
< /head >
<body>
< DIV Style="text-align:center" >
< table Border="0" BGCOLOR="#80FFFF" CELLSPACING="5" CELLPADDING="5" >
< tr Align="center" >
< TD >
< script type="text/javascript" >
< ! --
then = new Date ( 'Dec 1, 2008'); // here write date
document.write ( '<p> have gone <span id="timeSince">' then.timeSince (), '< /span > since 1 Decem 2008: < /p >');
if (document.getElementById) setInterval ( "document.getElementById ( 'time since'). firstChild.data = then.timeSince ()", Date.ONE_SECOND / 5);
// -- >
< /script >
< /TD >
< /TR >
< /TABLE > < /DIV >
< /body >
< /html >
Bookmarks