求C语言读取cookie时间代码解决思路
求C语言读取cookie时间代码
cookie时间格式如下:
expires=Fri, 02-Aug-2013 09:09:01 GMT
如何将02-Aug-2013 09:09:01这部分读取出来存放到<time.h>定义的struct tm结构中,求高人指点~~~~
------解决方案--------------------
------解决方案--------------------
cookie时间格式如下:
expires=Fri, 02-Aug-2013 09:09:01 GMT
如何将02-Aug-2013 09:09:01这部分读取出来存放到<time.h>定义的struct tm结构中,求高人指点~~~~
------解决方案--------------------
------解决方案--------------------
- C/C++ code
#include <time.h> #include <stdio.h> void main() { struct tm xmas = { 0, 0, 12, 25, 11, 93 }; mktime( &xmas ) ; printf( "%s\n", asctime( &xmas ) ); }
------解决方案--------------------
- C/C++ code
#include <time.h> #include <stdio.h> void main() { struct tm xmas = { 0, 0, 12, 25, 11, 93 }; mktime( &xmas ) ; printf( "time is: %s\n", asctime( &xmas ) ); char buf[50] = { 0 } ; strftime(buf, 50, "time is: %d-%b-%Y %H:%M:%S GTM \n", &xmas); printf(buf); }
------解决方案--------------------
------解决方案--------------------
- C/C++ code
sscanf(str_time,"%[^,], %2d-%[^-]-%4d %2d:%2d:%2d %s",week,&day,month,&year,&hour,&min,&sec,type);
------解决方案--------------------