php时间函数
时间:6年前 阅读:7434
<?php echo time(); //取得现在服务器的时间戳 1536462838 相对1970的 echo "<br>"; echo mktime(20,36,09,09,2018); //返回指定日期/时间的时间戳 格式mktime(分,秒,月,日,年) //输出时间戳结果 1686429360 echo "<br>"; echo "<br>"; ?>
2、PHPgetdate函数对应的参数
3、PHP取得时间戳与日期时间:getdate()
<?php
$t = time();
//getdate 返回参数时间戳转换成的日期/时间数组(如果没有参数时返回现在服务器的日期、时间数组)
$y = getdate($t);  //数组形式
//print_r($y); 输出结果 Array ( [seconds] => 48 [minutes] => 27 [hours] => 3 [mday] => 9 
//[wday] => 0 [mon] => 9 [year] => 2018 [yday] => 251 [weekday] => Sunday 
//[month] => September [0] => 1536463668 )
echo $y['year']."/".$y['mon']."/".$y['mday']."/".$y['minutes']."/".$y['seconds'];
//输出结果  2018/9/9/44/59
echo "<br>";
//checkdate(月,日,年) 的参数分别是
if(checkdate(9,9,2018)){   //check检查,checkdate 检查日期时间是否正确
echo "yes";
}else{
echo "no";
}
?> 
本站声明:网站内容来源于网络,如有侵权,请联系我们https://www.qiquanji.com,我们将及时处理。
 
                        微信扫码关注
更新实时通知





网友评论