PHP date () function of the parameters of the detailed

Source: Internet
Author: User

Date () function

This function is more familiar.

The code is as follows Copy Code

<?php
Echo ("Result with date (): <br/>");
Echo (Date ("L"). "<br/>");
Echo (Date ("L DS of F Y h:i:s A"). "<br/>");
Echo ("Oct 3,1975 is on a". Date ("L", Mktime (0,0,0,10,3,1975)). " <br/> ");
echo, Date (date_rfc822). "<br/>");
Echo (Date_atom,mktime (0,0,0,10,3,1975)). "<br/><br/>");

Echo ("Result with Gmdate (): <br/>");
Echo (Gmdate ("L"). "<br/>");
Echo (Gmdate ("L DS of F Y h:i:s A"). "<br/>");
Echo ("Oct 3,1975 is on a". Gmdate ("L", Mktime (0,0,0,10,3,1975)). " <br/> ");
Echo (Gmdate (date_rfc822). "<br/>");
Echo (Gmdate date_atom,mktime (0,0,0,10,3,1975)). "<br/>");
?>

Result with date ():
Wednesday
Wednesday 22nd of December 02:36:18 AM
Oct 3,1975 is on a Friday
Wed, Dec 10 02:36:18 +0000
1975-10-03t00:00:00+00:00

Result with Gmdate ():
Wednesday
Wednesday 22nd of December 02:36:18 AM
Oct 3,1975 is on a Friday
Wed, Dec 10 02:36:18 +0000
1975-10-03t00:00:00+00:00

Enclosed is a description of the date () function parameter in the PHP manual

A-"AM" or "PM"
A-"AM" or "PM"
D-days, two digits, if less than two digits before 0; for example: "01" to "" "
D-Day of the week, three English letters; for example:" Fri "
F-month , English full name; such as: "January"
h-12 hours, such as: "01" to ""
H-24 hours of the hour, such as: "00" to "" "
g-12 hours, less than two digits do not fill 0; For example:" 1 "to" G-24 hours of the hour, less than two to fill 0; such as: "0" to "a"
I-min; such as: "00" to "two"
J-days, two digits, if less than digits do not fill 0, such as: "1" to ""
L-Day of the week, the full name of the English language, such as: "Friday"
M-month, Two digits, if less than two in front of the 0; such as: "01" to "the"
N-month, two digits, if less than two digits, do not make up 0, such as: "1" to "a"
M-month, three English letters, such as: "The" "" "" ","
S-second, such as: "00" to ""
S-word Sukayin Text ordinal number, two English letters; such as: "th", "nd"
T-Specify the number of days of the month; such as: "28" to "
U-Total seconds
W-Number of days of the week, such as:" 0 "(Sunday) to" 6 "(Saturday)
Y-year, four digits; for example:" 1999 "
Y-year, two digits; such as: "" "
Z-the first days of the year, such as:" 0 "to" 365 "&NBSP;

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.