Explore the parameters of PHP call time format _php tips

Source: Internet
Author: User

1. Calling syntax
Use the function date () implementation to get the current time format, for example:

2. Time format parameter setting
"Y-m-d h:i:s" in the above syntax, displayed in the format: year-month-day: minutes: Seconds
So, we can just get the corresponding time parameters to replace the time format we want!

a– "AM" or "PM"
a– "AM" or "PM"
D-A few days, two digits, if less than two digits before the 0; such as: "01″ to" 31″
D-Day of the week, three English letters; such as: "Fri"
F – month, full name in English; such as: "January"
Hours of h–12 hours; such as: "01″ to" 12″
Hours of h–24 hours; such as: "00″ to" 23″
G–12 hours, less than two-bit not to fill 0; such as: "1″ to 12″
G–24 hours, less than two-bit not to fill 0; such as: "0″ to" 23″
I-compact minutes; such as: "00″ to" 59″
j– a few days, two digits, if less than two digits do not fill 0; such as: "1″ to" 31″
l– Day of the week, English full name; such as: "Friday"
m– month, two digits, if less than two in front of the 0; such as: "01″ to" 12″
Benzo vary thiazole month, two digits, if less than two, do not fill 0; such as: "1″ to" 12″
M– month, three English letters; such as: "The"
s– seconds; such as: "00″ to" 59″
s– the end of the word plus English ordinal number, two English letters; such as: "th", "nd"
T-the number of days of the specified month; such as: "28″ to" 31″
Total seconds of u–
W-Number of days of the week, such as: "0″ (Sunday) to" 6″ (Saturday)
y– years, four digits; such as: "1999″
y– years, two digits; such as: "99″
Z-day the first day of the year; such as: "0″ to" 365″

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.