echo date(‘Y-m-d H:i:s‘);
date_default_timezone_set (' PRC '); Set time zone
echo Date_default_timezone_get (); Gets the time zone information set by the server
Create function return timestamp mktime (1,2,22,1,5,2015)
echo mktime(1,2,22,1,5,2015).‘<br>‘;
echo date(‘Y-m-d H:i:s‘,1420390942);
time () Gets the timestamp of the current system,
echo time();
echo date(‘Y-m-d H:i:s‘,1431697515);
strtotime (' 1983-1-1 ')Timestamp of converting a date string to a number
$time=strtotime(‘1983-1-1‘);
echo $time.‘<br>‘;
echo date(‘Y年m月d日‘,410198400);
trtotime (' +2 Day ') returns the timestamp after 2 days
echo strtotime(‘+2 day‘).‘<br>‘;
echo date(‘Y-m-d H:i:s‘,1431871146);
Statistical message Time
$time="2015-5-15 22:17:1";
$t=strtotime($time);//输出$time的时间戳
$now=time(); //输出现在时间的时间戳
$rr=floor(($now-$t)/86400);//floor 表示取整数 $rr 表示现在距离留言时间的时间差为多少
$hh=floor(($now-$t)/3600);
$mm=floor(($now-$t)/60);
$ss=floor($now-$t);
if($rr>=30){
echo "留言时间为:$time";
}else if($rr>=1){
echo $rr.‘天前‘;
}else if($hh>=1){
echo $hh.‘小时前‘;
}else if($mm>=1){
echo $mm.‘分钟前‘;
}else{
echo $ss.‘秒前‘;
}
Statistics for member registration information within 7 days select COUNT (*) from member where regtime between Strtotime ('-7 days ') and time ();
From for notes (Wiz)
PHP Time and date