#include
#define WORD unsigned long
struct day
{ WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
};
struct day devtime;
int main(void)
{
char str[15] = "201210031506053112";
devtime.wYear = (str[0] - '0') * 1000 + (str[1] - '0') * 100 +
(str[2] - '0') * 10 + (str[3] - '0');
devtime.wMonth = (str[4] - '0') * 10 + (str[5] - '0');
devtime.wDay = (str[6] - '0') * 10 + (str[7] - '0');
devtime.wHour = (str[8] - '0') * 10 + (str[9] - '0');
devtime.wMinute = (str[10] - '0') * 10 + (str[11] - '0');
devtime.wSecond = (str[12] - '0') * 10 + (str[13] - '0');
devtime.wMilliseconds = 0;
devtime.wDayOfWeek = str[14] - '0';
printf(" devtime.wYear = %d\n devtime.wMonth = %d\n devtime.wDay = %d\n devtime.wHour = %d\n devtime.wMinute = %d\n devtime.wSecond = %d\n devtime.wMilliseconds = %d\n devtime.wDayOfWeek = %d\n ",
devtime.wYear,
devtime.wMonth,
devtime.wDay,
devtime.wHour,
devtime.wMinute,
devtime.wSecond,
devtime.wMilliseconds,
devtime.wDayOfWeek
);
return 0;
}
阅读(689) | 评论(0) | 转发(0) |