void
cal_date_by_mon( char * start_date, int nmon, char * date_buf )
{
int day;
int mon;
int year;
time_t t1;
struct tm m1;
year = bcl_get_year( start_date );
mon = bcl_get_month( start_date );
day = bcl_get_day( start_date );
time( &t1 );
m1 = *localtime( &t1 );
m1.tm_year = year - 1900;
m1.tm_mon = mon - 1 + nmon;
m1.tm_mday = 1;
t1 = mktime( &m1 );
m1 = *localtime( &t1 );
if( day >= bcl_get_mon_end( year, mon ) )
day = bcl_get_mon_end( m1.tm_year + 1900 , m1.tm_mon + 1 );
mon = m1.tm_mon + 1;
year = m1.tm_year + 1900;
strcpy( date_buf, start_date );
sprintf( date_buf, "%04d", year );
sprintf( &date_buf[ 4 ], "%02d", mon );
sprintf( &date_buf[ 6 ], "%02d", day );
return ;
}
阅读(869) | 评论(0) | 转发(0) |