教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 php 时间数据转换为时间戳代码

php 时间数据转换为时间戳代码

发布时间:2016-10-27   编辑:jiaochengji.com
教程集为您提供php 时间数据转换为时间戳代码等资源,欢迎您收藏本站,我们将为您提供最新的php 时间数据转换为时间戳代码资源
要做时间数据转换为时间戳我们利用php自带函数,strtotime() 函数将任何英文文本的日期时间描述解析为 Unix 时间戳

要做时间数据转换为时间戳我们利用strtotime() 函数将任何英文文本的日期时间描述解析为 Unix 时间戳

格式一 Fri Aug 05 12:19:04 0800 2011

<blockquote>

strtotime("Fri Aug 05 12:19:04 0800 2011");

</blockquote>

格式二 2011-02-01

<blockquote>

strtotime("2011-02-01");

</blockquote>

其它参考

<blockquote>

<?php
echo(strtotime("now"));
echo(strtotime("3 October 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"));
?>输出:

</blockquote>

1138614504
1128290400
1138632504
1139219304
1139503709
1139180400
1138489200

好了关于strtotime函数的实例也就这么多了,有需要的朋友可以参考一下。

您可能感兴趣的文章:
Javascript时间戳与php时间戳转换时要注意什么
php 创建以unix时间戳命名的文件夹
php 获取今日、昨日、上周、本月的起始与结束时间戳
php时间函数strtotime的深入理解
php 时间数据转换为时间戳代码
php与Mysql日期时间(UNIX时间戳、格式化日期)转换的方法
php获取本周、本月第一天与最后一天的时间戳
python时间戳是什么
php 时间戳函数总结与示例
php时间转换unix时间戳实例

[关闭]
~ ~