PHP 抓昨天的日期
date("Y/m/d", mktime(0, 0, 0, date('m'), date('d')-1, date('Y')));
or
date("Y/m/d", time()-24*3600);
or
date("Y/m/d", strtotime('-1 day'));
PHP 抓下個月的日期
date("Y/m/d", mktime(0, 0, 0, date('m')+1, date('d'), date('Y')));
date("Y/m/d", strtotime('+1 month'));
個人覺的strtotime比較好用
strtotime可用的參數如下,只列出部份
day month year hours days seconds week now .....
(next Thursday) (last Monday)
0 comments:
張貼留言