把字符串转换为时间戳
unsigned long strtotime(char *date)
{
struct tm t;
unsigned long time;
sscanf(date,"%d-%d-%d",&t.tm_year,&t.tm_mon,&t.tm_mday);
t.tm_year-=1900;
t.tm_mon-=1;
t.tm_hour=0;
t.tm_min=0;
t.tm_sec=0;
time=mktime(&t); //转换
return time;
}
相当于php中的strtotime函数