更改日期格式C
答
你可以用sprintf,像这样:
//date
int numeric_date = 20110430;
//convert integer to string
char numeric_date_string[9];
sprintf(numeric_date_string,"%d",numeric_date);
//format the string
char date[11];
sprintf(date,"%.4s/%.2s/%.2s",&numeric_date_string[0], &numeric_date_string[4], &numeric_date_string[6]);
+0
谢谢很多timesquare .. – jcrshankar 2011-04-30 04:24:04
被它存储为字符串(字符*)或INT? – MByD 2011-04-30 04:08:44