php date如何转换时间戳

php date转换时间戳的方法:首先创建PHP示例文件;然后通过“echo strtotime("now"), "\\\\n";”方法将date转换时间戳即可。

推荐:《PHP视频教程》

使用strotime函数,代码如下;

<?php
echo strtotime("now"), "\\\\n";
echo strtotime("10 September 2000"), "\\\\n";
echo strtotime(" 1 day"), "\\\\n";
echo strtotime(" 1 week"), "\\\\n";
echo strtotime(" 1 week 2 days 4 hours 2 seconds"), "\\\\n";
echo strtotime("next Thursday"), "\\\\n";
echo strtotime("last Monday"), "\\\\n";
echo strtotime("20170808 23:00:01"), "\\\\n";
?>

扩展资料:

PHP strtotime() 函数

1.strtotime,可以将美国英语格式时间字符串转换的函数。

2.strtotime()可以用英语的自然语言创建某个时刻的时间戳

3.函数语法:int strtotime(string $time[,int $now])

4.函数作用:将美国英语格式的日期时间字符串转换成unix时间戳。

更多关于云服务器域名注册虚拟主机的问题,请访问西部数码官网:www.west.cn

赞(0)
声明:本网站发布的内容(图片、视频和文字)以原创、转载和分享网络内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-62778877-8306;邮箱:fanjiao@west.cn。本站原创内容未经允许不得转载,或转载时需注明出处:西部数码知识库 » php date如何转换时间戳

登录

找回密码

注册