即我想知道如何得出下个月的今天?

解决方案 »

  1.   

    自己做一个函数,把当前月份当参数传进来,做几个switch而已!
      

  2.   


    operator + –       Add and subtract CTimeSpan and CTime objects. 
      

  3.   

    // crt_mktime.c
    /* The example takes a number of days
     * as input and returns the time, the current
     * date, and the specified number of days.
     */#include <time.h>
    #include <stdio.h>int main( void )
    {
       struct tm when;
       __time64_t now, result;
       int    days;   _time64( &now );
       when = *_localtime64( &now );
       printf( "Current time is %s\n", asctime( &when ) );
       days = 20;
       when.tm_mday = when.tm_mday + days;
       if( (result = _mktime64( &when )) != (time_t)-1 )
          printf( "In %d days the time will be %s\n", 
                  days, asctime( &when ) );
       else
          perror( "_mktime64 failed" );
    }
    Sample Output
    Current time is Tue Feb 12 09:57:44 2002In 20 days the time will be Mon Mar 04 09:57:44 2002
      

  4.   

    首先你知道当前的月有几天,然后在当前时间上加上这个天数就行了CTime tm = CTime::GetCurrentTime();
    int   day = tm.GetDay();
    CTimeSpan ts = CTimeSpan(day,0,0,0);
    tm += ts;