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

mac2022-06-30  93

实就是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"))  

 

  ======================

$time = date("Y-m-d H:i:s",time());echo date("Y-m-d h:i:s",strtotime($time." +20 minute"));

 

 

 

 

转载于:https://www.cnblogs.com/hgj123/p/6116536.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)