很多站长朋友们都不太清楚php到期时间计算,今天小编就来给大家整理php到期时间计算,希望对各位有所帮助,具体内容如下:
本文目录一览: 1、 php 根据月数算到期时间 2、 php 计算到期日期方式 3、 php代码 如何用生效时间和有效期(月数),算出到期时间呢? php 根据月数算到期时间代码如下:
<?php
$long_str = "this is a test to see how much time md5 function takes to execute over this string";
// start timing from here
$start = microtime(true);
// function to test
$md5 = md5($long_str);
$elapsed = microtime(true) - $start;
echo "That took $elapsed seconds.\n";
?>
运行结果如下:
That took 7.1525573730469E-6 seconds.
php 计算到期日期方式代码如下:
<?php
$long_str = "this is a test to see how much time md5 function takes to execute over this string";
// start timing from here
$start = microtime(true);
// function to test
$md5 = md5($long_str);
$elapsed = microtime(true) - $start;
echo "That took $elapsed seconds.\n";
?>
运行结果如下:
That took 7.1525573730469E-6 seconds.
php代码 如何用生效时间和有效期(月数),算出到期时间呢?将开始日期用strtotime($startTime)转为时间戳,然后将周期换算成秒,2者相加,再用date()函数得到的就是结束日期
$startTime = "2017-7-11";
$zq = "55";//天
$addTime = strtotime($startTime)+$zq*24*3600;
echo date('Y-m-d',$addTime);
关于php到期时间计算的介绍到此就结束了,不知道本篇文章是否对您有帮助呢?如果你还想了解更多此类信息,记得收藏关注本站,我们会不定期更新哦。
查看更多关于php到期时间计算 php日期时间函数的详细内容...