Countdown To 2011

Started on the old forum in August 2010 · view the original in the archive · old links redirect here

#countdown

5 replies · 707 views · started 16 years ago · 1 min read

5 participants
mrdizzy Newbie · 5 posts #1

alri peeps,bit of help needed, can any1 code the countdown to 2011 for wapdesirev2.. can u plz post it ere... Thankz

subzero Super moderator Fellow · 3,954 posts #2
function countdown()
{
//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";
}
}

echo countdown();

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

mrdizzy Newbie · 5 posts #3

subzero wrote:

function countdown()
{
//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";
}
}

echo countdown();

Wher does the echo countdown bit?

woody Developer · 176 posts #5

ech owont work in v2 change it to $main.=

clint Junior · 10 posts #6
<?PHP
date_default_timezone_set('Europe/London');  

     if ($date->format('n')==12 && $date->format('d')>24){
     $thisyear = $date->format('Y') + 1;}
     else{ $thisyear = $date->format('Y'); }

     $time = mktime(0, 0, 0, 12, 25, $thisyear, 23) - time();
     $days = floor($time/86400);
     $hours = floor(($time-($days*86400))/3600);
     $mins = floor (($time-($days*86400)-($hours*3600))/60);
     $secs = floor ($time-($days*86400)-($hours*3600)-($mins*60));
     $tsecs = $time;
     $tmins = round($time/3600*60);
     $thours = round($time/3600);

/*
************************************************
HOW TO DISPLAY THE NUMBER OF DAYS LEFT
otherwise you would have to say something
like "Only 1 day(s) left". This looks better!
************************************************
*/
if ($days == 1){
$daysremain = 'day';}

if ($days == 0){
$daysremain = '';}

else{
$daysremain = 'days';}

if ($days == 0){
$days = '';}

/*
************************************************
HOW TO DISPLAY THE NUMBER OF HOURS LEFT
************************************************
*/
if ($hours == 1){
$hoursremain = 'hour';}

if ($hours == 0){
$hoursremain = '';}

else{
$hoursremain = 'hours';}

if ($hours == 0){
$hours = '';}

/*
************************************************
AND NOW FOR THE MINUTES
************************************************
*/
if ($mins == 1){
$minsremain = 'minute';}

if ($mins == 0){
$minsremain = '';}

else{
$minsremain = 'minutes';}

if ($mins == 0){
$mins = '';}

      echo '<div><h2>UK Countdown To Christmas '. $thisyear .'</h2>';

           echo'It\'s only <b>' . $days . '</b> '. $daysremain .' <b>' . $hours . '</b> '. $hoursremain .' and <b>' .  $mins . '</b> '. $minsremain .' until Christmas!<br/>';

      echo '<br/>That\'s only <b>' . number_format($tmins) . '</b> minutes<br/>which is about <b>' . number_format($thours) . '</b> hours!<br/></div>';
?>

Just visiting!

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