绝对时间戳

编程入门 行业动态 更新时间:2024-10-24 14:21:48
本文介绍了绝对时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好,我刚刚开始使用绝对模板来了解时间戳。在其中一个示例中,它说 $ date1 = strtotime('2015-06-01'); 将输出 Mon 08/01/2015 ,但我只得到一个数字 1433113200 。我在做什么错了。

Hi I've just started learning about timestamp with an absolute template. In one of the examples it says $date1 = strtotime('2015-06-01'); will output Mon 08/01/2015 but I only get a number 1433113200. What am I doing wrong.

$date1 = strtotime('2015-06-01'); echo $date1;

推荐答案

像这样尝试,得到的数字是unix您日期的时间戳。您需要重新格式化。

Try like this, the number you get is the unix time stamp of your date. You need to reformat it.

$date1 = date('D d/m/Y h:i:s A',strtotime('2015-06-01')); echo $date1;

以下是您可以使用的格式列表(源)

Here's a list of format that you can use (Source)

Day of Month ____________ d | Numeric, with leading zeros 01–31 j | Numeric, without leading zeros 1–31 S | The English suffix for the day of the month st, nd or th in the 1st, 2nd or 15th. Weekday _______ l | Full name (lowercase 'L') Sunday – Saturday D | Three letter name Mon – Sun Month ______ m | Numeric, with leading zeros 01–12 n | Numeric, without leading zeros 1–12 F | Textual full January – December M | Textual three letters Jan - Dec Year ____ Y | Numeric, 4 digits Eg., 1999, 2003 y | Numeric, 2 digits Eg., 99, 03 Time ____ a | Lowercase am, pm A | Uppercase AM, PM g | Hour, 12-hour, without leading zeros 1–12 h | Hour, 12-hour, with leading zeros 01–12 G | Hour, 24-hour, without leading zeros 0-23 H | Hour, 24-hour, with leading zeros 00-23 i | Minutes, with leading zeros 00-59 s | Seconds, with leading zeros 00-59 T | Timezone abbreviation Eg., EST, MDT ... Full Date/Time c | ISO 8601 2004-02-12T15:19:21+00:00 r | RFC 2822 Thu, 21 Dec 2000 16:01:07 +0200

更多推荐

绝对时间戳

本文发布于:2023-10-24 09:41:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1523599.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时间

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!