PHP date function display time format

Formatting time

date () function for formatting time, returns a string.

grammar:

string date (string format [, int timestamp])
parameter represents the time format formatted manner it is possible in the following way:

Description of format:
Format way of illustration
Y 4 digit year, y is 2 digits, i.e. as 99 in 1999
m month figures, in front of the leading 0, such as 01. n is 0 no leading numeric month
F month, the full text, for example January or March
M represented by three letter abbreviations month, e.g. Mar Jan or
day of the month of d, front leading zero, such as 03. j is the number of days without leading 0
day of the week w, digital representation, Sunday 0 indicates
the day of the year z in the range of 0-366
of the year in which W weeks, as week 32
H 24 hour format with leading 0, h is the 12-hour format
G 24-hour format, no leading 0, g is the corresponding 12-hour format
i min format, with leading 0
S and seconds, with leading 0
on the A capitalized afternoon, such as AM, a lowercase
optional parameters timestamp represents a time stamp, the default is time (), that is, the current timestamp.

We display the date and time may be required, as in the example below by date (rich formatting functions provided):

date ( "Ymd", time ( )); // display format such as 2008-12-01
date ( "Ymd", time ( )); // display format as 2008.12.01
DATE ( "the Y M D", Time ( )); // display formats such as 2008 01 Dec
DATE ( "Ymd H: i", time ()); // display format such as 2008-12-01 12:01
Tip
If the output of your time and actual time difference of eight hours (assuming that Beijing time zone you're using), then check the php.ini file, make the following settings:

date.timezone = PRC
If you need to do is set a different time zone, please refer to: http://www.php.net/manual/en/timezones.php

date () function
  function: for formatting time, returns a string.
  Syntax: string date (string format [, int timestamp]), wherein the parameter represents a time format formatted manner; represents optional parameter timestamp timestamp, default Time (), i.e. the current time.

Time formatting mode
format way of illustration
Y 4 digit year, y is 2 digits, i.e. as 99 in 1999
m month figures, in front of the leading 0, such as 01. n is 0 no leading numeric month
F month, the full text, for example January or March
M represented by three letter abbreviations month, e.g. Mar Jan or
day of the month of d, front leading zero, such as 03. j is the number of days without leading 0
day of the week w, digital representation, Sunday 0 indicates
the day of the year z in the range of 0-366
of the year in which W weeks, as week 32
H 24 hour format with leading 0, h is the 12-hour format
G 24-hour format, no leading 0, g is the corresponding 12-hour format
i min format, with leading 0
S and seconds, with leading 0
on the A capitalized afternoon, such as AM, a lowercase

Guess you like

Origin www.cnblogs.com/KillBugMe/p/11423004.html