PHP Gets the current date and time and formatting method parameter _php instance

Source: Internet
Author: User

Use the function date () to implement the

Copy Code code as follows:

<?php Echo $showtime =date ("y-m-d h:i:s");? >

displayed in the format: year-month-day hours: minutes: sec

Related Time parameters:

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, full name in English; such as: "January"
h-12 hours, such as: "01" to "the"
H-24 hours of hours, such as: "00" to "" "
g-12 hours, less than two-bit 0; For example:" 1 "to 12 "
G-24 hours of hours, less than two bits not 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 digits 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 ""
M-month, three English letters, such as: "The" "" after "
S-second, such as:" 00 "to" the "
S- The end of the word plus English 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; 1999 "
Y-year, two digits; such as:" "
Z-day of the Year; For example:" 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.