<?php <?php
< /code><code class="php comments" style="font-size:1em;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; background:none;border:0px; float:none;margin:0px;padding:0px;vertical-align:baseline;min-height:auto;color:rgb(0,130,0);">// 默认时区
date_default_timezone_set( 'PRC' );
echo date ( "Y-m-d H:i:s" ), "n" ;
echo date ( 'Y-m-d' , strtotime ( '+1 day' , strtotime ( '2016-09-12' ))), "nn" ;
echo strtotime ( '2016-09-12' ), "n" ;
echo date ( "Y-m-d" , '1473609600' ), "n" ;
echo date ( "Y-m-d" , '1573609600' ), "n" ;
$d = "2016-09-12 10:12:20" ;
echo date ( "Y-m-d" , strtotime ( "$d +1 day" )), "nn" ;
function date2time( $d ){
$year =((int) substr ( "$d" ,0,4));
$month =((int) substr ( "$d" ,5,2));
$day =((int) substr ( "$d" ,8,2));
return mktime (0,0,0, $month , $day , $year );
}
echo date2time( "2016-09-12" ), "nn" ;
$date_1 = "2066-09-12" ;
$date_2 = "2016-09-12" ;
$Date_List_a1 = explode ( "-" , $date_1 );
$Date_List_a2 = explode ( "-" , $date_2 );
$d1 = mktime (0,0,0, $Date_List_a1 [1], $Date_List_a1 [2], $Date_List_a1 [0]);
$d2 = mktime (0,0,0, $Date_List_a2 [1], $Date_List_a2 [2], $Date_List_a2 [0]);
$Days = round (( $d1 - $d2 )/3600/24);
echo "$date_2 -> $date_1 相差: $Days 天" , "n" ;
?>
|