标签:北京时间 turn and -- standard time utc 字符 bsp
int standard_to_stamp(char *str_time)
{
struct tm stm;
int iY, iM, iD, iH, iMin, iS;
memset(&stm,0,sizeof(stm));
iY = atoi(str_time);
iM = atoi(str_time+5);
iD = atoi(str_time+8);
iH = atoi(str_time+11);
iMin = atoi(str_time+14);
iS = atoi(str_time+17);
stm.tm_year=iY-1900;
stm.tm_mon=iM-1;
stm.tm_mday=iD;
stm.tm_hour=iH;
stm.tm_min=iMin;
stm.tm_sec=iS;
/*printf("%d-%0d-%0d %0d:%0d:%0d\n", iY, iM, iD, iH, iMin, iS);*/ //标准时间格式例如:2016:08:02 12:12:30
return (int)mktime(&stm);
}
注:北京时间格式--标准时间格式 YY-MM-DD hh:mm:ss 间隔符号无所谓,不管是“-”、“/”还是什么,只要每间隔一个字符就OK
标签:北京时间 turn and -- standard time utc 字符 bsp
原文地址:https://www.cnblogs.com/azbane/p/10172408.html