#include <stdio.h>
#include <time.h>
#include <windows.h>
int main()
{
SYSTEMTIME s;
GetLocalTime(&s);
printf("It's %d/%d/%d %02d:%02d:%02d now.", s.wYear, s.wMonth, s.wDay, s.wHour, s.wMinute, s.wMinute);
printf("\nAnd it's the %d day of a week.", s.wDayOfWeek);
struct tm *ptr;
time_t lt;
__int64 w(1617669906);
lt = (time_t)w;
printf("The Calendar Time now is %d\n", lt);
ptr = localtime(<);
printf("hour:%d minute:%d second:%d \n ", ptr->tm_hour, ptr->tm_min, ptr->tm_sec);
lt = time(NULL);
printf("The Calendar Time now is %d\n", lt);
ptr = localtime(<);
printf("hour:%d minute:%d second:%d \n ", ptr->tm_hour, ptr->tm_min, ptr->tm_sec);
return 0;
}
SYSTEMTIME和time_t的用法例子
最新推荐文章于 2024-05-08 13:35:48 发布