Determine the number of days in the current month
To determine the number of days in the current month, you can use the T parameter of date () to consider the following code:
printf ("There is%d days in%s.", Date ("T"), Date ("F"));
If executed in April, the following results are output:
There is in April.
Determine the number of days in any given month
Sometimes you might want to determine the number of days in a month, not the current month. This requirement cannot be achieved with the date () function, because
It requires a timestamp, and now only the year and the month. However, the mktime () function can be used to generate the desired result. Suppose the Greek
To determine the number of days in February 2007:
$lastday = Mktime (o, 0, 0, 3, 0,);p rintf ("There is%d days in February.", Date ("T$lastday");
Execute this code to get the following output:
There is in February 2007.
"Read" The detailed tutorial see "PHP and MySQL program design," The 52nd page, OK Bookstore (www.okpdf.com) to provide e-book: Click to download
650) this.width=650; "src=" Http://www.okpdf.com/attachment/1407/thread/3_1_f0f2fd7ffe57c75.png "width=" 384 "height = "516" alt= "3_1_f0f2fd7ffe57c75.png"/>