Possible Duplicate:
how to find first day of the next month and remain days to this date with php
I have this to get 1st day of current month
$_SERVER['dataInicio'] = date('Y') . "-" . date('m') . "-" . "1";
I need something similar to get 1st day of NEXT month
For getting the first day of next month based on given date in Excel, the following formula can help you. Select a blank cell, enter formula =DATE(YEAR(A2),MONTH(A2)+1,1) into the Formula Bar and then press the Enter key. Then use the Fill Handle to get the rest dates.
To get the same date next month from a given date, you can use the EDATE function. EDATE can get the "same date" in the future or past, based on the number of months supplied. When 1 is given for months, EDATE gets the same date next month.
The EOMONTH function returns the last day of the month for a given date. So, in this formula EOMONTH first returns a date corresponding to the last day of the month, and then DAY returns the date... Working from the inside out, the EOMONTH function gets the last day of month of any date.
Enter your due dates in column A. Enter the number of days to add or subtract in column B. You can enter a negative number to subtract days from your start date, and a positive number to add to your date. In cell C2, enter =A2+B2, and copy down as needed.
$date = new DateTime('now');
$date->modify('first day of next month');
echo $date->format('D') . '\n';
$date->modify('first day of this month');
echo $date->format('D') . '\n';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With