The time in PHP has two formatting functions: date () and gmdate (), which are described in the official document as follows:
Date -- format a local time/date
Gmdate -- format a gmt/UTC date/time and return the Greenwich Mean Time (GMT ).
For
Here we will introduce the differences between the date functions in php. Here we mainly talk about the differences in the usage of date and gmdate. If you need them, please refer to them.
Date-format a local time/date
The date/time function allows
The time in PHP has two formatting functions: date () and gmdate (). the description in the official document is date -- format a local time/date.
Gmdate -- format a GMT/UTC date/time and return the Greenwich Mean Time (GMT ).
For example, if
Difference between date and gmdate in the date function in php
Echo date ('Y-m-d H: I: S', time (); output: 2013-03-14 12:15:27
Echo gmdate ('Y-m-d H: I: S', time (); output: 2013-03-14 04:15:27
The above is the
Date--Format a local time/date
Gmdate-Formats a GMT/UTC date/time and returns Greenwich Standard (GMT).
For example, the time zone we're in is +8, so the server should return the following script:
Current time assumption is 2007-03-14 12:15:27
Date-format a local time/dateThe date/time function allows you to extract and format the date and time on the server.Note: these functions depend on the local settings of the server.InstallThe date/time function is a core component of PHP. These
echo Date (' y-m-d h:i:s ', Time ()); Output is: 2013-03-14 12:15:27
echo gmdate (' y-m-d h:i:s ', Time ()); Output is: 2013-03-14 04:15:27
Copy CodeThe above is the result of running PHP under Linux+apache.Running under Windows, the 2
The date/time function allows you to extract and format the date and time on the server. These functions depend on the local settings of the server.
First, we will introduce the time () function:Time () function
The time () function returns the
Definition and UsageThe Gmdate () function formats the GMT/UTC date/time.Similar to the date () function, the difference is that the time returned is Greenwich Mean Time (GMT).Grammar
Parameters
Description
Copy CodeThe code is as follows:
echo Mktime (11,25,0,9,5,2010);//the same as time
Echo Microtime ();
echo Mktime (0,0,0,1,1,1970);
?>
The output is 1283657290, 1283657100, 0.88533200 1283657290, 25200, respectively. From the last value, we know
Copy Code code as follows:
echo Mktime (11,25,0,9,5,2010);
Echo Microtime ();
echo Mktime (0,0,0,1,1,1970);
?>
This output is 1283657290, 1283657100, 0.88533200 1283657290, and-25200 respectively. From the last value, we know
PHP gmdate () functionPHP date/time functionDefinitions and usageThe Gmdate () function formats the GMT/UTC date/time.
Similar to the date () function, the difference is that the time returned is Greenwich Standard (GMT).
GrammarGmdate
The date function in PHP can be implemented in the format of dates and time display, this is also a few examples we commonly used, the following to introduce to you friends, I hope this tutorial is helpful.
Time () function
The time () function
Time () functionThe time () function returns the Unix timestamp of the current time. Returns the number of seconds from the Unix epoch (January 1, January 1, 1970 00:00:00 GMT) to the current time.Since PHP 5.1, the timestamp at the TIME when the
Do you want to add a calendar to your blog? blue1000 here with you to share a simple PHP blog calendar Implementation Code, there is a need for a friend to refer to, there is a query database this is very simple, you just modify the field name and
Parameters of the phpdate () function are described in detail. in php, the date () function can be used to obtain the time and date. it may be a commonly used function. next I will share with you the date () function () function 1 is an unknown
Use perl to port ls commands in linux to windows-Linux general technology-Linux programming and kernel information. For more information, see the following. File: ls.rar
#! /Usr/bin/perl
Use strict;
# Use Win32: File qw (GetAttributes );
My $ dir
Add the php code for the calendar in the blog. Do you want to add a calendar to your blog by adding the php code for adding a calendar? Blue1000 is here to share with you a simple PHP blog calendar implementation code. if you need it, refer to the
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.