#include <Windows.h> #include <stdio.h> struct Date { short moth; short day; short year; }; DWORD ShowFileTime(PFILETIME lptime) { FILETIME ftLocal; SYSTEMTIME st; FileTimeToLocalFileTime(lptime,&ftLocal); FileTimeToSystemTime(&ftLocal,&st); printf("%d年%#02d月%#02d日,%#02d:%#02d:%#02d\n",st.wYear,st.wMilliseconds,st.wDay,st.wHour,st.wMilliseconds,st.wSecond); return 0; } int main() { WIN32_FILE_ATTRIBUTE_DATA wfad; if(!GetFileAttributesEx("main.cpp",GetFileExInfoStandard,&wfad)) { printf("获取文件属性失败:%d\n",GetLastError()); system("pause"); return 1; } printf("创建时间:\t"); ShowFileTime(&wfad.ftCreationTime); printf("Hello\n"); system("pause"); return 0; }
时间: 2024-10-05 21:31:11