Home > Backend Development > PHP Tutorial > PHP time format control character comparison table sharing_PHP tutorial

PHP time format control character comparison table sharing_PHP tutorial

WBOY
Release: 2016-07-21 14:59:46
Original
718 people have browsed it

format character Description Example of return value
--- ---
d The day of the month, a 2-digit number with leading zeros 01 to 31
j Day of the month, no leading zero 1 to 31
S The English suffix after the day of the month, 2 characters st, nd, rd or th. Can be used with j
z Day of the year 0 to 366
week --- ---
l (lower case letter of "L") Day of the week, complete text format Sunday to Saturday
D Day of the week, text representation, 3 letters Mon to Sun
N Day of the week represented by numbers in ISO-8601 format (new in PHP 5.1.0) 1 (for Monday) to 7 (for Sunday)
w The day of the week, represented by numbers 0 (meaning Sunday) to 6 (meaning Saturday)
W The week number of the year in ISO-8601 format, each week starts on Monday (new in PHP 4.1.0) Example: 42 (the 42nd week of the year)
Month --- ---
F Month, complete text format, such as January or March January to December
m The month represented by the number, with leading zeros 01 to 12
M The month represented by the three-letter abbreviation Jan to Dec
n Numeric month, without leading zeros 1 to 12
t The number of days in a given month 28 to 31
Year --- ---
L Whether it is a leap year 1 if it is a leap year, 0 otherwise
o ISO-8601 format year number. This is the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used.(PHP 5.1.0 新加) Examples: 1999 or 2003
Y 4 位数字完整表示的年份 例如:1999 或 2003
y 2 位数字表示的年份 例如:99 或 03
时间 --- ---
a 小写的上午和下午值 am 或 pm
A 大写的上午和下午值 AM 或 PM
B Swatch Internet 标准时 000 到 999
g 小时,12 小时格式,没有前导零 1 到 12
G 小时,24 小时格式,没有前导零 0 到 23
h 小时,12 小时格式,有前导零 01 到 12
H 小时,24 小时格式,有前导零 00 到 23
i 有前导零的分钟数 00 到 59>
s 秒数,有前导零 00 到 59>
时区 --- ---
e 时区标识(PHP 5.1.0 新加) 例如:UTC,GMT,Atlantic/Azores
I 是否为夏令时 如果是夏令时为 1,否则为 0
O 与格林威治时间相差的小时数 例如:+0200
P 与格林威治时间(GMT)的差别,小时和分钟之间有冒号分隔(PHP 5.1.3 新加) 例如:+02:00
T 本机所在的时区 例如:EST,MDT(【译者注】在 Windows 下为完整文本格式,例如“Eastern Standard Time”,中文版会显示“中国标准时间”)。
Z 时差偏移量的秒数。UTC 西边的时区偏移量总是负的,UTC 东边的时区偏移量总是正的。 -43200 到 43200
完整的日期/时间 --- ---
c ISO 8601 格式的日期(PHP 5 新加) 2004-02-12T15:19:21+00:00
r RFC 822 格式的日期 例如:Thu, 21 Dec 2000 16:01:07 +0200
U 从 Unix 纪元(January 1 1970 00:00:00 GMT)开始至今的秒数 即时间戳 参见 time()

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/328108.htmlTechArticleformat Character Description Return Value Example Day --- --- d The day of the month, with leading zeros The 2-digit number 01 to 31 j The day of the month, without leading zeros 1 to 31 S The day of the month followed...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template