2008年5月17日 星期六

時間日期加減

date("y-m-d",mktime(0,0,0,date("m"),(date("d")+7),date("y")));//加7天
date("YmdHis",mktime(date("H"),date("i")+3,date("s"),date("m"), date("d"),date("Y")));//加3分

date('YmdHis', strtotime('+3 minutes')); //加3分
date('YmdHis', strtotime('tomorrow')); //明天

strtotime --- 剖析任何英文的日期時間成為UNIX時間戳記
strtotime('now');//現在的UNIX時間戳記
strtotime("+3 day");//現在加3天的UNIX時間戳記
strtotime("-3 day");//現在減3天的UNIX時間戳記

沒有留言:

張貼留言