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?

Recommended Answers

All 6 Replies

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

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

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

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

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.