PHP date knowledge _ PHP Tutorial

Source: Internet
Author: User
PHP date knowledge. (1) date usage: date (format, [time]); if there is no time parameter, the current time is used. the format is a string, the following characters have special significance: U is replaced with a start time (good (1) date
Usage: date (format, [time]);
If there is no time parameter, the current time is used. the format is a string. The following characters have special meanings:
U is replaced by the number of seconds since the start time (like January 1, 1970 ).

Y is replaced with the 4-digit year number.
Y is replaced with the 2-digit year number.
F is replaced with the full name of the month.
M is replaced with the abbreviation of the month.
M is replaced with the monthly number of copies.
Z is replaced by the number of days since January 1 of the current year.
D. replace it with the daily number.
L replace it with the full name of the day of the week.
D. replace it with the abbreviation of the day of the week.
W is replaced with the day of the week (number ).
Replace H with the hour (in the 24-hour format ).
Replace h with the hour (in 12-hour format ).
Replace I with the number of minutes.
Replace s with the number of seconds.
A is replaced with "AM" or "PM ".
A is replaced with "am" or "pm ".
S is replaced with a sequential numeric suffix, for example, "st", "nd", "rd", "th ".

(2) PHP calculation of two time differences

$ Date = floor (strtotime ($ enddate)-strtotime ($ startdate)/86400 );

Http://www.bkjia.com/PHPjc/760670.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/760670.htmlTechArticle (1) date usage: date (format, [time]); use the current time if there is no time parameter. the format is a string. The following characters have special meanings: U is replaced with a start time (good...

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.