I was doing some searching for different codes and I found out how to do this little basic one:
Code:
<html>
<head>
<title>JavaScript Countdown timer test</title>
<script language="javascript" type="text/javascript">
today = new Date();
todayEpoch = today.getTime();
target = new Date("DD MM, YYYY");
targetEpoch = target.getTime();
daysLeft = Math.floor(((targetEpoch - todayEpoch) / (60*60*24)) / 1000);
</script>
</head>
<body>
<h1>SOMETHING HERE HAPPENS in
<script>document.write(daysLeft);</script>
days. EXTRA/OPTIONAL TEXT HERE
</h1>
</body>
And heres my result:
Code:
<html>
<head>
<title>JavaScript Countdown timer test</title>
<script language="javascript" type="text/javascript">
today = new Date();
todayEpoch = today.getTime();
target = new Date("27 July, 2007");
targetEpoch = target.getTime();
daysLeft = Math.floor(((targetEpoch - todayEpoch) / (60*60*24)) / 1000);
</script>
</head>
<body>
<h1>The Simpsons Movie premieres WORLDWIDE in
<script>document.write(daysLeft);</script>
days. Freeze yourself if you want!
</h1>
</body>