Some 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
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.
echo dateDiff("/", $date2, $date1);?>
So all you have to do is do something like the following for the output.
My site is echo dateDiff("/", $date2, $date1);?> days old today.
Give it a try! ๐
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?
I’m waiting for your server load script.
How do i get the server load value in percentage? like the one at the bottom of the page…
Server Load is 16.75%
You need to wait till Goldfries release the codes.
Released! faster go see!
this is good stuff!!! thanks
thanks! ๐
rwar!
yay the code works!
mah site is 560 days old. :p
thanks for sharing the script yo! ๐
Done checking the new post~
what checking new post? ๐