PHP 日期 加减 月数,天数,周数,小时,分,秒等等

其实就是strtotime 这个内置函数

//PHP 日期 加减 周date("Y-m-d",strtotime("2013-11-12 +1 week"))
//PHP 日期 加减 天数date("Y-m-d",strtotime("2013-11-12 12:12:12 +1 day"))
//PHP 日期加减小时date("Y-m-d h:i:s",strtotime("2013-11-12 12:12:12 +1 hour"))
//PHP 日期 加减 月数date("Y-m-d",strtotime("2013-11-12 12:12:12 +1 month"))
//PHP 日期 加减 分date("Y-m-d h:i:s",strtotime("2013-11-12 12:12:12 +1 minute"))
//PHP 日期 加减 秒date("Y-m-d h:i:s",strtotime("2013-11-12 12:12:12 +1 second"))

感谢: http://www.php.net/manual/zh/function.strtotime.php#88679

猜你喜欢

转载自blog.csdn.net/ld17822307870/article/details/113095464