Scratch
Here you will find older scratches, musings and other detritus that once were located on the front pages, but have now faded.
Filed away here to collect dust and cobwwwebs in perpetuity, links may break, facts may change and data may corrupt.
On occasion I may come down here to tidy, but for the most, I prefer to leave the past where it lies.
PHP Countdown
is what skitz was doing on the 21 Jun 2004 at around 21:00.This is a post in the currently section which details how I was occupying my time when I made the posting, and as such it may seem a bit empty.
On occasion there may be information below, a note or reminder to myself, perhaps some code, a link to what I'm working towards, thumbnails, etc.
For a complete listing of items in this category see here.
Further Information:
Moved away from MTCountdown as would seem to only work with re-builds.
<?php
function countdown($target_date, $event='') {
/* get difference */
$diff = time() - strtotime($target_date);
$end = (substr($diff, 0, 1) == '-') ? " until $event": " since $event";
$diff = abs($diff);
/* calculate difference */
$years = intval($diff/(60*60*24*365));
$diff -= ($years*60*60*24*365);
$months = intval($diff/(60*60*24*30));
$diff -= ($months*60*60*24*30);
$weeks = intval($diff/(60*60*24*7));
$diff -= ($weeks*60*60*24*7);
$days = intval($diff/(60*60*24));
$diff -= ($days*60*60*24);
$hours = intval($diff/(60*60));
$diff -= ($hours*60*60);
$minutes = intval($diff/60);
$diff -= ($minutes*60);
$seconds = intval($diff);
/* output difference */
$output = '';
$output .= ($years > 0) ? "$years years " : '';
$output .= ($months > 0) ? "$months months " : '';
$output .= ($weeks > 0) ? "$weeks weeks " : '';
$output .= ($days > 0) ? "$days days " : '';
$output .= ($hours > 0) ? "$hours hours " : '';
$output .= ($minutes > 0) ? "$minutes minutes " : '';
$output .= ($seconds > 0) ? "$seconds seconds " : '';
$output .= $end;
echo $output;
/* echo "$years years $months month(s) $weeks week(s) $days day(s) $hours hour(s) $minutes minute(s) $seconds second(s)"; */
}
echo countdown('May 29, 2004',' my birthday').'<br />';
echo countdown('5/29', 'my birthday').'<br />';
echo countdown('25 Dec', 'Christmas').'<br/>';
echo countdown('Jan 1, 2004', ' New Years');
?>
21 Jun 2004 21:00 | (0) comments | currently
Related Entries
By Date
Monthly Archive for June 2004
Previous entry: « petfrog
Next entry: » Sky Tonight
By Category
Category Index: currently
Previous entry: « Configuring MTCountdown
Next entry: » CSS
By MySQL
Please bear in mind these are deemed related by an automatic script. That doesn't mean they always are.
