0

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?

5
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by darkagn
0

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 :)

0
//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

0

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

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.