2011-01-19 34 views

回答

0

像這樣的事情

mktime(0, 0, 0, date("m")); //it's 00:00 first day of current month 
mktime(0, 0, 0, date("m")-1); //it's 00:00 first day of previous month 
mktime(0, 0, 0, date("m")-2); //it's 00:00 first day 2 month before 
mktime(0, 0, 0, date("m")-3); //it's 00:00 first day 3 month before 

該函數返回UNIX時間戳,可與日期功能被格式化。

你需要閱讀功能:date()mktime()

0

這可以通過appyling PHP

的字符串到時間的方法
$lastMonth = date('m', strtotime('last month')); 
$twoMonthsAgo = date('m', strtotime('-2 months')); 
$threeMonthsAgo = date('m', strtotime('-3 months')); 

做你可以閱讀更多有關的strtotime這裏:http://www.php.net/strtotime

相關問題