How to count date like this with PHP

Hi guys,

I wonder if anyone can give me the right direction or suggest keywords that I can do a research on.

I would like to count date like under the headline of a post on the website bellow:

http://www.benhuh.com/

Thanks for your help in advance.

You could use UNIX timestamp and calculate the number of days since the post was made till the current date.

To convert your date and time to UNIX timestamp you may use strtotime() function:
http://us.php.net/manual/en/function.strtotime.php

Example:

$start = strtotime($your_date);
$end = strtotime(“now”);
days = round(($end-$start)/86400);

not entirely sure why you would count days instead of a more user-friendly format, but yeah…

(Which do you associate more with: 156 days or 5 months?)

Check out PHP Calendar Functions:

http://www.php.net/manual/en/ref.calendar.php

GregorianToJD — Converts a Gregorian date to Julian Day Count

Valid Range for Gregorian Calendar 4714 B.C. to 9999 A.D.

int gregoriantojd ( int $month , int $day , int $year )

Hi guys,

Thanks for response. Much appreciated.

@StarLion - I think it would impressed visitors like when I like visit a web site with the feature.