PHP uses Gmdate to implement the method of formatting a Unix time into GMT text _php tutorial

Source: Internet
Author: User

PHP uses Gmdate to implement the method of formatting a Unix time into GMT text


This article mainly introduces PHP using gmdate implementation of a UNIX time format into GMT text method, the example analysis of PHP gmdate function and the use of skills, with a certain reference value, the need for friends can refer to the next

This example describes how PHP uses gmdate to format a UNIX time into GMT text. Share to everyone for your reference. The specific analysis is as follows:

The syntax is as follows:

?

1

2

String Gmdate (String $Format)

String Gmdate (string $Format, int $Time)

Demo Code

?

1

2

3

4

5

6

7

8

9

Ten

One

+

!--? php

echo "When this page is loaded,\n";

Echo ' It is 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 ' isn't ');

Echo "a leap year\n";

Echo Time (' U '), "seconds had elapsed since January 1, 1970.\n";

?

The output results are as follows:

?

1

2

3

4

5

6

7

8

9

10

When the This page is loaded,

It was and then Sun, Dec 2009 13:08:53 +0000

The Currend Gmdate was December 27, 2009

The Currend Gmdate was Dec 27, 2009

The Currend gmdate was 12/27/09

The Currend Gmdate was the 27th of Dec, 2009

The currend time was 1:08:53 PM GMT

The currend time was 13:08:53 +0000

A leap year

1261919333 seconds had elapsed since January 1, 1970.

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/970745.html www.bkjia.com true http://www.bkjia.com/PHPjc/970745.html techarticle PHP uses Gmdate to implement the method of formatting a Unix time into GMT text this article mainly introduces PHP using the gmdate implementation of a UNIX time format into GMT text method, example analysis ...

  • 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.