mysql to_days,str_to_date函数的使用2010-11-22 16:33:58| 分类:实验室|举报|字号订阅如果你操作数据库时想通过时间加以限制,那么请以这样的形式存储时间:year-month-day hour:minute:second,给一个linux下的存储方法:void *gettime(char name[]){struct tm *p;//char name[512];char c[5];time_t t;t=time(NULL);p=localtime(&t;);sprintf(c,"%d",1900+p->tm_year);strcat(name,c);strcat(name,"-");if(1+p->tm_mon<10)strcat(name,"0");sprintf(c,"%d",1+p->tm_mon);strcat(name,c);strcat(name,"-");if(p->tm_mday<10)strcat(name,"0");sprintf(c,"%d",p->tm_mday);strcat(name,c);strcat(name," ");if (p->tm_hour<10)strcat(name,"0");sprintf(c,"%d",p->tm_hour);strcat (name,c);strcat(name,":"
...
继续阅读
(18)