2个回答
展开全部
#include <time.h>
#include <stdio.h>
#include <windows.h>
int main()
{
// Method1:
time_t now;
time(&now);
printf("Now is: %s", ctime(&now));
// Method2:
SYSTEMTIME LocalTime;
GetLocalTime(&LocalTime);
printf("\n\nYear:\t\t %d", LocalTime.wYear);
printf("\nMonth:\t\t %d", LocalTime.wMonth);
printf("\nDay:\t\t %d", LocalTime.wDay);
printf("\nDayOfWeek:\t %d", LocalTime.wDayOfWeek);
printf("\nHour:\t\t %d", LocalTime.wHour);
printf("\nMinute:\t\t %d", LocalTime.wMinute);
printf("\nSecond:\t\t %d", LocalTime.wSecond);
printf("\nMilliseconds:\t %d", LocalTime.wMilliseconds);
}
#include <stdio.h>
#include <windows.h>
int main()
{
// Method1:
time_t now;
time(&now);
printf("Now is: %s", ctime(&now));
// Method2:
SYSTEMTIME LocalTime;
GetLocalTime(&LocalTime);
printf("\n\nYear:\t\t %d", LocalTime.wYear);
printf("\nMonth:\t\t %d", LocalTime.wMonth);
printf("\nDay:\t\t %d", LocalTime.wDay);
printf("\nDayOfWeek:\t %d", LocalTime.wDayOfWeek);
printf("\nHour:\t\t %d", LocalTime.wHour);
printf("\nMinute:\t\t %d", LocalTime.wMinute);
printf("\nSecond:\t\t %d", LocalTime.wSecond);
printf("\nMilliseconds:\t %d", LocalTime.wMilliseconds);
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
查查msdn有没有GetSystemTime()这样的函数,你那个函数是不能得到一个时间类型的。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询