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.哪种语言都行,谢谢!

解决方案 »

  1.   

    sql版:
    SELECT ADDDATE(ADDDATE("2011-5-29",INTERVAL -DAYOFMONTH("2011-5-29") day),INTERVAL 2 MONTH)
    outputs:2011-06-30
      

  2.   

    网上有现成的 第一天和最后一天function getthemonth($date)
    {
    $firstday = date('Y-m-01', strtotime($date));
    $lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day"));
    return array($firstday, $lastday);
      

  3.   

    在 php 版问,自然就是 php 答
    $s = '2010/10/15';
    echo date('Y/m/t', strtotime("1 month $s"));
    2010/11/30
      

  4.   

    刚我还想琢磨的写个 易语言版的,想了半天该怎么开始...哈哈哈函数开始 月份日期(输入日期1)
    返回 xxxx
    函数结束....
      

  5.   

    C#:
    DateTime.Parse(DateTime.Parse("输入的日期").ToString("yyyy-MM-01")).AddMonths(2).AddDays(-1).Date.ToString("dd");
      

  6.   


    php -r ' echo date("Y/m/t", strtotime("1 month 2011/10/31")); '
    给出了2011/12/31
      

  7.   

    这个更可靠点:
    echo date("Y/m/t", strtotime("last day of next month 2011/12/31"));