PHP 时间函数strtotime的使用技巧
2017-05-16 23:02:37
•
阅读
打赏
本文主要介绍了PHP 时间函数strtotime的使用技巧。分享给大家供大家参考,欢迎大家的学习。
时间加减
//当前时间年份+1
$date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1));
PHP函数strtotime,对时间进行加减:
int strtotime ( string time [, int now] )
返回类型 int
函数用于时间转换和加减。
//date()格式化时间返回String类型。
////加一年
$date_year = date('Y-m-d', strtotime("$date + 1 year"));
echo $date_year;
//加一天
$date_tomorrow = date('Y-m-d', strtotime("2009-06-26 + 1 day"));
echo $date_tomorrow;
//加一周
$date_week = date('Y-m-d', strtotime("$date + 1 week"));
echo $date_week;
Unix时间戳(timestamp)转换工具:
http://dev.yuqingqi.com/unixtime/
以上就是本文PHP 时间函数strtotime的使用技巧的全部内容,希望本文所述对大家PHP程序设计有所帮助。
相关推荐
深度学习 -- 损失函数
深度残差网络(Deep Residual Networks (ResNets))
深度学习 -- 激活函数
神经网络训练 -- 调整学习速率
生成对抗网络(GAN)改进与发展
生成对抗网络(GAN)优点与缺点
生成对抗网络(GAN)的训练
生成对抗网络(GAN)基本原理
生成模型与判别模型