本文實例講述了PHP獲取昨天、今天及明天日期的方法。分享給大家供大家參考,具體如下:
//PHP返回昨天的日期function get_last_date() { $tomorrow = mktime(0,0,0,date("m"),date("d")-1,date("Y")); return date("Y-m-d", $tomorrow);}//PHP返回今天的日期function get_today_date() { $today=date("Y-m-d"); return today;}//PHP返回明天的日期function get_tomorrow_date() { $tomorrow = mktime(0,0,0,date("m"),date("d")+1,date("Y")); return date("Y-m-d", $tomorrow);}
希望本文所述對大家PHP程序設計有所幫助。