如何获取文件生成时间?
获取文件 "d:\aaa.txt "文件的生成时间,要 "mm:ss "格式
[解决办法]
WIN32_FIND_DATA Data;
TDateTime dt;
SYSTEMTIME stCreate;
HANDLE hFile = FindFirstFile( "d:\aaa.txt ", &Data);
if(hFile != INVALID_HANDLE_VALUE)
{
FileTimeToSystemTime(&Data.ftCreationTime,&stCreate);
dt=SystemTimeToDateTime(stCreate);
ShowMessage(FormatDateTime( "mm:ss ",dt));
}
要不就用GetFileTime函数也可以,使用方法看看帮助吧
[解决办法]
int hFile = FileOpen( "d:\\aaa.txt " , fmOpenRead);
TDateTime dt = FileDateToDateTime(FileGetDate(hFile));
FileClose(hFile);
ShowMessage(FormatDateTime( "nn:ss ",dt));
[解决办法]
AnsiString ct=FormatDateTime( "hh:mm ",dt);