php中date转换时间戳的方法

发布时间:2020-10-24 14:11:09 作者:小新
来源:亿速云 阅读:163

这篇文章将为大家详细讲解有关php中date转换时间戳的方法,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

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

使用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中date转换时间戳的方法

扩展资料:

PHP strtotime() 函数

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

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

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

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

关于php中date转换时间戳的方法就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

推荐阅读:
  1. php中的时间戳转换
  2. php时间戳怎么转换?

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

date php dat

上一篇:字符串在Python中怎么输出

下一篇:python批量修改交换机密码的示例

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》