PHP uses gmdate to implement a UNIX time format to GMT text _php tips

Source: Internet
Author: User

The example in this article describes how PHP uses the Gmdate implementation to format a UNIX time as GMT text. Share to everyone for your reference. The specific analysis is as follows:

The syntax is as follows:

String Gmdate (String $Format)
string gmdate (string $Format, int $Time)

Demo Code

<?php
echo "When this page is 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 is ', gmdate (' g:i:s A T '), "\ n";
Echo ' The currend time is ', gmdate (' h:i:s O '), "\ n";
echo gmdate (' Y ');
Gmdate (' L ')? (print ' is '):(print ' isn't ');
echo "a leap year\n";
echo Time (' U '), "seconds had elapsed since January 1, 1970.\n";
? >

The output results are as follows:

When this page is loaded,
It is then Sun, Dec 2009 13:08:53 +0000
The Currend gmdate was December, 2009
   the currend Gmdate was Dec 2009 the Currend gmdate
is 12/27/09 the Currend
Gmdate was the 27th of Dec, 2009 The currend time is
1:08:53 PM GMT
The currend time was 13:08:53 +0000
2009 are not a leap year 1261919333 seconds had elapsed since January
1, 1970.

I hope this article will help you with your PHP program design.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.