码迷,mamicode.com
首页 > Web开发 > 详细

php 时间戳函数

时间:2015-05-11 09:09:08      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:

1.mktime

mktime ($hour = null, $minute = null, $second = null, $month = null, $day = null, $year = null, $is_dst = null)

小时,分钟,秒数,月,日,年   mktime(‘17‘,‘23‘,‘35‘);

2.strtotime

strtotime(time,now)

参数 描述
time 规定要解析的时间字符串。
now 用来计算返回值的时间戳。如果省略该参数,则使用当前时间。

<?php
echo(strtotime("now"));      现在的时间
echo(strtotime("3 October 2005"));     2005年十月三号
echo(strtotime("+5 hours"));           加五个小时
echo(strtotime("+1 week"));           加一周
echo(strtotime("+1 week 3 days 7 hours 5 seconds"));     加一周三天七小时五秒
echo(strtotime("next Monday"));         下周一
echo(strtotime("last Sunday"));         上周日
?>

输出:

1138614504
1128290400
1138632504
1139219304
1139503709
1139180400
1138489200

php 时间戳函数

标签:

原文地址:http://blog.csdn.net/genziisme/article/details/45622973

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!