countdown script

Started on the old forum in September 2009 · view the original in the archive · old links redirect here

No replies · 461 views · started 17 years ago · 1 min read

riderz Lead · 975 posts #1

here are a countdown script till xmas

<?php

//A
$today = time();

//B
$event = mktime(0,0,0,12,25,date("Y"));

//C
$apart = $event - $today;

//D
if ($apart >= -86400)
{
  $myevent = $event;
}

//E
else
{
  $myevent = mktime(0,0,0,12,25,date("Y")+1);
}

//F
$countdown = round(($myevent - $today)/86400);

//G
if ($countdown > 1)
{
  echo "$countdown days until Christmas";
}

//H
elseif (($myevent-$today) <= 0 && ($myevent-$today) >= -86400)
{
  echo "Today is Christmas!";
}

//I
else
{
  echo "$countdown day until Christmas";
}

?>

usage on index.php main

include ("xmas.php");


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close