Jump to content

PHP date


dotkpay

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.