Reply
Age Count Up Script?
Old 07-15-2004, 05:09 AM Age Count Up Script?
ASims's Avatar
Junior Talker

Posts: 2
Location: SC
I'm looking for a script that will count up from a birthdate...similar to the one at this site: http://www.trixieupdate.com (on left, underneath header image)...I have found some that count by day, hour, sec. etc...but I would like it to be like the one at the site mentioned above (ie: year, month, days). Does anyone know where I can find one of these scripts?

I did find this script called 'the first year' and it has a count-up script like what I'm looking for but I don't want to use the entire script, only that part. I would like to insert this count-up script into my private blog (php) about my son (whom is 10 months old). Thanks for any help!
ASims is offline
Reply With Quote
View Public Profile Visit ASims's homepage!
 
When You Register, These Ads Go Away!
     
Old 07-15-2004, 07:42 AM
Average Talker

Posts: 16
here is some script that might help you a little. this only counts days, hours, seconds thou..
there is something that makes it go off by one hour after a couple of years. I am not sure why it does that.

PHP Code:
<?php
$stamp 
strtotime(" 21 march 1986 12:00:00"); //the date and time you where born
$stamp2 strtotime("now"); 
$diff = ($stamp2 $stamp);

$days floor($diff 86400);
$hour floor(($diff $days 86400)/ 3600);
$min floor(($diff $days 86400 $hour 3600) / 60);
$sec floor($diff  $days 86400 $hour 3600 $min 60);
$return "I am $days days $hour h $min m $sec s old";
echo 
$return;
?>
output:
I am 6691 days 0 h 41 m 24 s old
__________________
-=nestyra.com=-
nestyra is offline
Reply With Quote
View Public Profile
 
Old 07-15-2004, 07:58 AM
Average Talker

Posts: 16
here is another one with years and months.. but it is the average year, and the average month...
PHP Code:
<?php
$stamp 
strtotime("21 march 1986 12:00:00"); //the date and time 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 year $months months $days days $hour h $min m $sec s old";
echo 
$return;
?>
output:
I am 18 year 3 months 25 days 8 h 50 m 46 s old
__________________
-=nestyra.com=-
nestyra is offline
Reply With Quote
View Public Profile
 
Old 07-17-2004, 02:07 PM
ASims's Avatar
Junior Talker

Posts: 2
Location: SC
Thank you SO much nestyra - the second one works perfectly! I edited a little bit (removed hours, minutes, seconds) and it works just like I wanted! Thank you SO much for your help!!!!!
ASims is offline
Reply With Quote
View Public Profile Visit ASims's homepage!
 
Old 07-17-2004, 06:42 PM
Average Talker

Posts: 16
remember it is based on average years and average months... so there will allways be a little difference...glad you liked it thou..
__________________
-=nestyra.com=-
nestyra is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Age Count Up Script?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12063 seconds with 13 queries