PHP uses gmdate to format a UNIX time into GMT text. PHP uses gmdate to format a UNIX time into GMT text. This article describes how to format a UNIX time into GMT text using gmdate in PHP, example analysis PHP uses gmdate to format a UNIX time into GMT text
This article mainly introduces how to format a UNIX time into GMT text using gmdate in PHP. The example analyzes the functions and usage skills of the gmdate function in php, which has some reference value, for more information, see
This example describes how PHP uses gmdate to format a UNIX time into GMT text. Share it with you for your reference. The specific analysis is as follows:
Syntax:
?
1 2 |
String gmdate (string $ Format) String gmdate (string $ Format, int $ Time) |
Demo code
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Echo "When this page was loaded, \ n "; Echo 'it was then', gmdate ('r'), "\ n "; Echo 'The currend gmdate was', gmdate ('F j, y'), "\ n "; Echo 'The currend gmdate was', gmdate ('m j, y'), "\ n "; Echo 'The currend gmdate was', gmdate ('m/d/Y'), "\ n "; Echo 'The currend gmdate was The ', gmdate ('JS \ o \ f M, y'), "\ n "; Echo 'The currend time was', gmdate ('G: I: s A t'), "\ n "; Echo 'The currend time was', gmdate ('H: I: s o'), "\ n "; Echo gmdate ('Y '); Gmdate ('L ')? (Print 'is') :( print 'is not '); Echo "a leap year \ n "; Echo time ('u'), "seconds had elapsed since January 1, 1970. \ n "; ?> |
The output result is as follows:
?
1 2 3 4 5 6 7 8 9 10 |
When this page was loaded, It was then Sun, 27 Dec 2009 13:08:53 + 0000 The currend gmdate was December 27,200 9 The currend gmdate was Dec 27,200 9 The currend gmdate was 12/27/09 The currend gmdate was the 27th of Dec 2009 The currend time was 1:08:53 GMT The currend time was 13:08:53 + 0000 2009 is not a leap year 1261919333 seconds had elapsed since January 1, 1970. |
I hope this article will help you with php programming.
This article describes how to format a UNIX time into GMT text by using gmdate in PHP...