tag:blogger.com,1999:blog-8722048993094113071.post559162225365908310..comments2023-09-11T06:34:38.721-07:00Comments on The world is amazing: PHP: How to get the last day of a monthUnknownnoreply@blogger.comBlogger1125tag:blogger.com,1999:blog-8722048993094113071.post-36467665335557367802009-10-29T04:35:56.639-07:002009-10-29T04:35:56.639-07:00Thanks for sharing your findings. In this case, y...Thanks for sharing your findings. In this case, you can also use the php function "cal_days_in_month" which works for most dates of interest (between the 1500s or so to some time in the future. For example:<br /><br />$num = cal_days_in_month(CAL_GREGORIAN, $month, $year);<br /><br />Or you could use the date and mktime functions:<br /><br />$last_day = date('d', mktime(0, 0, 0, $this->month + 1, 0, $this->year)); <br /><br />Keep coding and sharing.Anonymousnoreply@blogger.com