1. Calculate the last day of Next month
Input: a date (including: year, month, day)
Output: last day of next month (including: year,month, day)
E.g. input: 2010/10/15; output: 2010/11/30
2. Test your program systemically. Write your testing cases.哪种语言都行,谢谢!
Input: a date (including: year, month, day)
Output: last day of next month (including: year,month, day)
E.g. input: 2010/10/15; output: 2010/11/30
2. Test your program systemically. Write your testing cases.哪种语言都行,谢谢!
SELECT ADDDATE(ADDDATE("2011-5-29",INTERVAL -DAYOFMONTH("2011-5-29") day),INTERVAL 2 MONTH)
outputs:2011-06-30
{
$firstday = date('Y-m-01', strtotime($date));
$lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day"));
return array($firstday, $lastday);
}
$s = '2010/10/15';
echo date('Y/m/t', strtotime("1 month $s"));
2010/11/30
返回 xxxx
函数结束....
DateTime.Parse(DateTime.Parse("输入的日期").ToString("yyyy-MM-01")).AddMonths(2).AddDays(-1).Date.ToString("dd");
php -r ' echo date("Y/m/t", strtotime("1 month 2011/10/31")); '
给出了2011/12/31
echo date("Y/m/t", strtotime("last day of next month 2011/12/31"));