Script : Age of Website
April 8th, 2009 | Viewed 3600 timesSome of you would probably be wondering how the “# of days old” at the footer of this site is done.
Here’s the script for you guys to try out. Just make sure PHP is supported on your site and it’s all well.
Copy and paste the following script into the page or section where you would like to place the output. You could actually place this script ANYWHERE on the site but I would suggest you put it just before the output script for ease of editing.
Calculation Script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <?
function dateDiff($dformat, $endDate, $beginDate)
{
$date_parts1=explode($dformat, $beginDate);
$date_parts2=explode($dformat, $endDate);
$start_date=gregoriantojd($date_parts1[0],
$date_parts1[1], $date_parts1[2]);
$end_date=gregoriantojd($date_parts2[0],
$date_parts2[1], $date_parts2[2]);
return $end_date - $start_date;
}
$date1="05/31/2007";
$date2=(date("m")."/".date("d")."/".date("Y"));
?> |
Now you could shorten the lines but due to the lack of width of the content area in wordpress, I’m forced to split the code into a few more lines than needed.
The only line that you need to change for the script above, is line #12. Just change it to the date where your site started.
The Output
The output script is a short and simple code, no editing needed.
1 | <? echo dateDiff("/", $date2, $date1);?> |
So all you have to do is do something like the following for the output.
1 | My site is <? echo dateDiff("/", $date2, $date1);?> days old today. |
Give it a try!




April 8th, 2009 at 3:33 pm
I’d tested it on my blog and it works like a charm.
Thanks Goldfries.
BTW, are you going to try P1 WiMax’s Wiggy?
April 8th, 2009 at 3:34 pm
I’m waiting for your server load script.
April 9th, 2009 at 6:11 pm
How do i get the server load value in percentage? like the one at the bottom of the page…
Server Load is 16.75%
April 9th, 2009 at 10:00 pm
You need to wait till Goldfries release the codes.
April 13th, 2009 at 4:39 am
Released! faster go see!
April 14th, 2009 at 11:01 am
this is good stuff!!! thanks
April 20th, 2009 at 12:58 am
thanks!
April 20th, 2009 at 12:13 pm
rwar!
yay the code works!
mah site is 560 days old. :p
thanks for sharing the script yo!
April 21st, 2009 at 11:18 am
Done checking the new post~
April 28th, 2009 at 11:55 am
what checking new post?
June 6th, 2009 at 3:29 am
[...] Some of you would probably be wondering how the “# Load average” at the downward footer of this site is done . For upward Age of Website please refer my friend site here [...]