实例
<?php
//设置时区
date_default_timezone_set('PRC');
// time();实例<?php
date_default_timezone_set('PRC');
// time();时间戳
// echo date('Y-m-d H:i:s'); 今天
echo date('Y-m-d H:i:s',time()-3600*24*100);
// 获取100天以前的日期
echo '<hr>';
echo strtotime('2010-1-1 12:12:12'); //日期转时间戳
echo '<hr>';
echo date('Y-m-d H:i:s',strtotime('+1 year +55 day')); //明年在的55天天
echo '<hr>';
echo date('Y-m-d H:i:s',strtotime('next friday')); //周五
?>运行实例 »点击 "运行实例" 按钮查看在线实例
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号