PHP gets a specific number of days per month

Source: Internet
Author: User

Method 1:

$firstday Mktime (0,0,0,$month, 1,$year// the Unix timestamp for the    first day of the given month $daysdate(' T ',$firstday// Returns the number of days  in the specified month

Method 2:

$days Cal_days_in_month (Cal_gregorian, 4, 2013); // returns 2003-02 of the  number of days

Method 3:

$days Date Strtotime ($year$month . '-01 ')); //

Method 4:

$ndays Date // return   the number of days for this month and this year Date ("J",mktime(0,0,0,$month+1,0,$year

PHP gets a specific number of days per month

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.