PHP Date function method of formatting Unix time
This article mainly introduces the PHP date function Dates format Unix time method, example of PHP in the use of the date function, the need for friends can refer to the following
This example describes the PHP date function, which formats Unix time. Share to everyone for your reference. The specific analysis is as follows:
Date functions can format a UNIX time to the desired text output according to the specified format
Use the following function syntax
?
1 2 |
String Date (string $Format); String Date (string $Format, int $Time); |
Here is the demo code
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
echo "When this page is loaded,\n"; Echo ' It is 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 ' was not '); echo "a leap year\n"; echo Time (' U '), "seconds had elapsed since January 1, 1970.\n"; ?> |
The output is as follows
?
1 2 3 4 5 6 7 8 9 |
It is then Sat, 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 A leap year 1261811391 seconds had elapsed since January 1, 1970. |
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/970748.html www.bkjia.com true http://www.bkjia.com/PHPjc/970748.html techarticle PHP Date Function method Date format Unix time this article mainly introduces the PHP date function Dates format Unix time method, the example analyzes the use of the date function in PHP, the need for friends ...