这篇文章主要为大家详细介绍了PHP 利用日期函数格式化一个UNIX时间为文本,具有一定的参考价值,可以用来参考一下。
对PHP日期函数 - 格式化一个UNIX时间为文本感兴趣的小伙伴,下面一起跟随四海网的小编两巴掌来看看吧!
/**
* PHP日期函数 - 格式化一个UNIX时间为文本
*
* @param
* @arrange 512-笔记网: www.q1010.com
**/
string date (string $Format);
string date (string $Format, int $Time);
/*** 来自四海网(www.q1010.com) ***/
下面是演示代码
/**
* PHP日期函数 - 格式化一个UNIX时间为文本
*
* @param
* @arrange 512-笔记网: www.q1010.com
**/
<?php
echo "When this page was loaded,\n";
echo 'It was then ', date ('r'), "\n";
echo 'The currend date was ', date ('F j, Y'), "\n";
echo 'The currend date was ', date ('M j, Y'), "\n";
echo 'The currend date was ', date ('m/d/y'), "\n";
echo 'The currend date was the ', date ('jS \o\f M, Y'), "\n";
echo 'The currend time was ', date ('g:i:s A T'), "\n";
echo 'The currend time was ', date ('H:i:s O'), "\n";
echo date ('Y');
date ('L')?(print ' is'):(print ' is not');
echo " a leap year\n";
echo time ('U'), " seconds had elapsed since January 1, 1970.\n";
?>
/*** 来自四海网(www.q1010.com) ***/
输出结果如下
/**
* PHP日期函数 - 格式化一个UNIX时间为文本
*
* @param
* @arrange 512-笔记网: www.q1010.com
**/
It was then Sat, 26 Dec 2009 07:09:51 +0000
The currend date was December 26, 2009
The currend date was Dec 26, 2009
The currend date was 12/26/09
The currend date was the 26th of Dec, 2009
The currend time was 7:09:51 AM GMT
The currend time was 07:09:51 +0000
2009 is not a leap year
1261811391 seconds had elapsed since January 1, 1970.
/*** 来自四海网(www.q1010.com) ***/
本文来自:http://www.q1010.com/173/951-0.html
注:关于PHP 利用日期函数格式化一个UNIX时间为文本的内容就先介绍到这里,更多相关文章的可以留意四海网的其他信息。
关键词:UNIX
四海网收集整理一些常用的php代码,JS代码,数据库mysql等技术文章。