Форум: "Основная";
Текущий архив: 2002.03.21;
Скачать: [xml.tar.bz2];
ВнизВремя создания файла. Найти похожие ветки
← →
lipskiy (2002-03-06 01:58) [1]Откопал в своих проектах. Два куска - в одном поиск файлов через FindFirst - FindNext с выдачей времени файла в стринговом формате, в другом куске (функция) конвертация в удобоворимый вид.
var
srec:tsearchrec;
timedata:TWin32FindData;
filetime:tfiletime;
systime:Tsystemtime;
Time,buf:int64;
begin
findfirst(...,faanyfile,srec);
...
timedata:=srec.FindData;
FileTimeToLocalFileTime(timedata.ftLastWriteTime,filetime);
buf:= filetime.dwHighDateTime;
buf:= buf shl 32;
Time:= inttostr(buf + filetime.dwLowDateTime);
end;
//##############################################################################
function TForm1.ConvertTime(InTime:string):string;
//##############################################################################
var
Time:int64;
filetime:tfiletime;
systime:Tsystemtime;
dy,mt,yr,hr,mn,sc:string;
begin
if InTime="0" then
begin
result:= "";
exit;
end;
Time:= strtoint64(InTime);
filetime.dwLowDateTime:= (Time and $ffffffff);
filetime.dwHighDateTime:= (Time shr 32 and $ffffffff);
FileTimeToSystemTime(filetime,systime);
if systime.wDay < 10 then dy:= "0"+inttostr(systime.wDay) else dy:= inttostr(systime.wDay);
if systime.wMonth < 10 then mt:= "0"+inttostr(systime.wMonth) else mt:= inttostr(systime.wMonth);
if systime.wHour < 10 then hr:= "0"+inttostr(systime.wHour) else hr:= inttostr(systime.wHour);
if systime.wMinute < 10 then mn:= "0"+inttostr(systime.wMinute) else mn:= inttostr(systime.wMinute);
if systime.wSecond < 10 then sc:= "0"+inttostr(systime.wSecond) else sc:= inttostr(systime.wSecond);
result:= Dy+"."+Mt+"."+inttostr(systime.wYear)+" "+Hr+":"+Mn+":"+Sc;
end;
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2002.03.21;
Скачать: [xml.tar.bz2];
Память: 0.44 MB
Время: 0.006 c