Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
gizmo2
Hangin' Around


Joined: Sep 15, 2007
Posts: 34
Location: Germany

PostPosted: Sun Jun 21, 2009 12:08 pm Reply with quote

I'm looking for a script that displays a countdown the other way. I need to show how much years, days and minutes ago a special date was. I need to show with this block how old my daugter is. Does anyone knows such a script?

Thanks in advance!


Last edited by gizmo2 on Sun Jun 21, 2009 3:08 pm; edited 1 time in total 
View user's profile Send private message
nuken
RavenNuke(tm) Development Team


Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Sun Jun 21, 2009 12:37 pm Reply with quote

Code:
<?php

###############################################################################
# RavenNuke(tm) Countup block  http://trickedoutnews.com
###############################################################################
# This program is free software. You can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License.
###############################################################################
if (stristr($_SERVER['SCRIPT_NAME'], "block-Countup.php"))
{
   Header("Location: ../../index.php");
   die();
}
$stamp = strtotime("1 april 1970 "); //the date you where born
$stamp2 = strtotime("now");
$diff = ($stamp2 - $stamp);
$years = floor($diff / 31556927.29); //the average year is 365.242214 days :)
$months = floor(($diff -$years * 31556927.29)/ 2629743.941); // the average month :P
$days = floor(($diff- $years * 31556927.29 - $months * 2629743.941) / 86400);
$return = "I am $years year $months months $days days old";
$content = $return;
?>


Put this in a file in your blocks folder named block-Countup.php and change the 1 april 1970 to the date of birth you want.

_________________
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Send e-mail Visit poster's website
nuken
PostPosted: Tue Jun 23, 2009 6:19 am Reply with quote

This one shows years, months, days, hours, minutes, seconds

Code:
<?php

###############################################################################
# RavenNuke(tm) Countup block  http://trickedoutnews.com
###############################################################################
# This program is free software. You can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License.
###############################################################################
if (stristr($_SERVER['SCRIPT_NAME'], "block-Countup.php"))
{
   Header("Location: ../../index.php");
   die();
}
$stamp = strtotime("1 april 1980 12:00:00"); //the date you where born
$stamp2 = strtotime("now");
$diff = ($stamp2 - $stamp);
$years = floor($diff / 31556927.29); //the average year is 365.242214 days :)
$months = floor(($diff -$years * 31556927.29)/ 2629743.941); // the average month :P
$days = floor(($diff- $years * 31556927.29 - $months * 2629743.941) / 86400);
$hour = floor(($diff- $years * 31556927.29 - $months * 2629743.941 - $days * 86400)/ 3600);
$min = floor(($diff- $years * 31556927.29 - $months * 2629743.941 - $days * 86400 - $hour * 3600) / 60);
$sec = floor($diff- $years * 31556927.29 - $months * 2629743.941  - $days * 86400 - $hour * 3600 - $min * 60);
$return = "I am $years years $months months $days days $hour h $min m $sec s old";
$content = $return;
?>
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©