dotkpay Posted December 30, 2011 Share Posted December 30, 2011 Hi, The function date with the parameter "t" returns the number days in the current month as in, echo date("t"); // number of days in current month But supposing I want to find out the number of days of the previous month or lets say March, I need a function to find it programmatically because of the application structure, that is why I cant impose conditional statements for every month Link to comment https://forums.phpfreaks.com/topic/254066-php-date/ Share on other sites More sharing options...
The Little Guy Posted December 30, 2011 Share Posted December 30, 2011 echo date("t", strtotime("march 2011")); echo "<br />"; echo date("t", strtotime("previous month")); echo "<br />"; echo date("t", strtotime("now - 2 months")); echo "<br />"; echo date("t", strtotime("now + 2 years")); echo "<br />"; echo date("t", strtotime("now + 2 years 1 month")); Link to comment https://forums.phpfreaks.com/topic/254066-php-date/#findComment-1302460 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.