kevinsmith121
asked on
Countdown to my Birthday
Dear all,
I am developing a website that I hope to launch on my 30th Birthday, this is in a few weeks, on the homepage I would like to display a neat digital countdown to my birthday 12/05/2005. The site is going to be dedicated to life during my 30's so it is quite significant, also after I turn 30 it would be cool to display how long I have been in my 30's for. If you are interested the site is www.30somethinggamer.com, there is no content on the site at the moment at all it is just an empty shell, any advice would be most appreciated
Many thanks
Kevin
I am developing a website that I hope to launch on my 30th Birthday, this is in a few weeks, on the homepage I would like to display a neat digital countdown to my birthday 12/05/2005. The site is going to be dedicated to life during my 30's so it is quite significant, also after I turn 30 it would be cool to display how long I have been in my 30's for. If you are interested the site is www.30somethinggamer.com, there is no content on the site at the moment at all it is just an empty shell, any advice would be most appreciated
Many thanks
Kevin
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is an excellent set of answers with GwynforWeb's being the best, I have implimented, upped the points and awarded accordingly
many thanks
Kevin
many thanks
Kevin
thx for the points, this is better. There is still a problem with daylight savings which I will look into.
<script>
birth=new Date("Apr 22 2005 00:00:01")
function showDiff(){
now=new Date()
diffTime=now.getTime()-bir th.getTime ()
if (diffTime > 0)
msg="<p>Since my 30th birthday"
else{
msg="<p>To my 30th birthday"
diffTime=-diffTime
}
diff=new Date(diffTime+now.getTimez oneOffset( )*60*1000)
msg='<center><font size=5>'+(diff.getFullYear ()-1970)+' years ' + diff.getMonth() + ' Months '+ (diff.getDate()-1)+' days ' + diff.getHours()+' hours ' + diff.getMinutes()+' minutes '+ diff.getSeconds()+' seconds' +msg+'</font></center>'
document.getElementById("s howTime"). innerHTML= msg
}
</script>
<body onload="showDiff();setInte rval('show Diff()',10 00)">
<div id="showTime"></div>
</body>
</html>
<script>
birth=new Date("Apr 22 2005 00:00:01")
function showDiff(){
now=new Date()
diffTime=now.getTime()-bir
if (diffTime > 0)
msg="<p>Since my 30th birthday"
else{
msg="<p>To my 30th birthday"
diffTime=-diffTime
}
diff=new Date(diffTime+now.getTimez
msg='<center><font size=5>'+(diff.getFullYear
document.getElementById("s
}
</script>
<body onload="showDiff();setInte
<div id="showTime"></div>
</body>
</html>
ah ha, I have got it exact at last, change to the birthday to hour 1
birth=new Date("Apr 22 2005 01:00:00")
birth=new Date("Apr 22 2005 01:00:00")
ASKER