## mrcniceguy 5

In my website i want to introduce a link where people will see who joined the site for example today,yesterday one week ago,2week ago and one month ago...
how i`m i going to do this in php?

## darkagn 315

Algorithm:

First, get the date that they joined and convert to timestamp (strtotime function)
Next, get todays date in timestamp format (time function)
Then subtract current time from joined time
Now, number of seconds in one day is 24 * 60 * 60. Use this figure to calculate the number of days since the person joined.
Next, convert the number of days to a string detailing years, months, weeks and days. You can do this using division and modulo arithmetic (%) quite easily.

Hope this helps :)

## sureronald

Don't you forget to save the results in a database for easier access

## mrcniceguy 5

i converted to timestamp,but the calcutions is still a problem...

## queenc -1

``````//present date
\$tomorrow = mktime(0,0,0,date("m"),date("d"),date("Y"));
\$day=date("Y-m-d", \$tomorrow);
\$cdate=strtotime(\$day);
\$ \$expiredate1=2009-01-01;
\$dateDiff = \$expiredate1 - \$cdate;
\$fullDays = floor(\$dateDiff/(60*60*24));
echo \$fullDays;``````

try this

## darkagn 315

i converted to timestamp,but the calcutions is still a problem...

Post your code so we can see what you have done?