将UNIX时间戳转换为格式化日期字符串 [英] Converting a UNIX Timestamp to Formatted Date String
本文介绍了将UNIX时间戳转换为格式化日期字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用PHP,我想将UNIX时间戳转换为类似于以下内容的日期字符串:2008-07-17T09:24:17Z
Using PHP, I want to convert UNIX timestamps to date strings similar to this: 2008-07-17T09:24:17Z
如何将诸如1333699439
的时间戳转换为2008-07-17T09:24:17Z
?
How do I convert a timestamp such as 1333699439
to 2008-07-17T09:24:17Z
?
推荐答案
尝试 gmdate
像这样:
Try gmdate
like this:
<?php
$timestamp=1333699439;
echo gmdate("Y-m-d\TH:i:s\Z", $timestamp);
?>
这篇关于将UNIX时间戳转换为格式化日期字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文