好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

php strtotime()计算今天与指定日期之天数 - php日期

php strtotime()计算今天与指定日期之天数

php strtotime()计算今天与指定日期之天数

$date1  =  strtotime ( '2011-04-30' );  //把日期转换成时间戳   $date2  = time();  //取当前时间的时间戳     $nowtime = strftime ( "%y年-%m月-%d日 " , $date2 );  //格式化输出日期     $days = round (( $date1 - $date2 )/3600/24);  //四舍五入     echo   "今天是<font color=" red ">" . $nowtime . "</font>" ;  echo   "<br/>距" . strftime ( "%y年-%m月-%d日 " , $date1 ). "还有<font colr=" red ">" . $days . "</font>天" ;    echo   date ( "y-m-d h:i:s" , strtotime ( "now" )).  "<br />" ;  echo   date ( "y-m-d h:i:s" , strtotime ( "10 september 2000" )).  "<br />" ;  echo   date ( "y-m-d h:i:s" , strtotime ( "+2 day" )).  "<br />" ;  echo   date ( "y-m-d h:i:s" , strtotime ( "+1 week" )).  "<br />" ;  echo   date ( "y-m-d h:i:s" , strtotime ( "+1 week 2 days 4 hours 2 seconds" )).  "<br />" ;  echo   date ( "y-m-d h:i:s" , strtotime ( "next thursday" )).  "<br />" ;  echo   date ( "y-m-d h:i:s" , strtotime ( "last monday" )).  "<br />" ;  echo   date ( "y-m-d h:i:s" , strtotime ( "+3 day" , strtotime ( '2001-01-01' ))); 

查看更多关于php strtotime()计算今天与指定日期之天数 - php日期的详细内容...

  阅读:74次