MyBB Community Forums

Full Version: Counting certain stats from first of each month?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm working on a plugin where I want to output certain characteristic/data from the first of last month to first of the current month.

I saw php's date function:

http://ie2.php.net/manual/en/function.date.php

$tomorrow  = mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"));
$lastmonth = mktime(0, 0, 0, date("m")-1, date("d"),   date("Y"));
$nextyear  = mktime(0, 0, 0, date("m"),   date("d"),   date("Y")+1);

That's fine, but say how would I query the date condition?

For example, let's say, I want to output certain's user post made during the last month, then how would I query $lastmonth function to output the data likewise?

Thank you.
Will try that definitely, thanks. Meanwhile if anyone has a different way to do so as well, do let me know. It's always good to have few ways to do things efficiently.