Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi _FILETIME to String (https://www.delphipraxis.net/110753-_filetime-string.html)

kcx 24. Mär 2008 00:30


_FILETIME to String
 
Hi,

Hab mal ne kurze Frage, und zwar, wie bekommt man den Datentyp _FILETIME (in der Unit Windows) zu einen String?

TimeToStr() funktioniert leider nicht.

Danke :zwinker:

Die Muhkuh 24. Mär 2008 00:42

Re: _FILETIME to String
 
Hi,

schau Dir mal MSDN-Library durchsuchenFileTimeToSystemTime sowie Delphi-Referenz durchsuchenSystemTimeToDateTime an

kcx 24. Mär 2008 00:56

Re: _FILETIME to String
 
Danke, hab jetzt folgendes:
Delphi-Quellcode:
function FileTimeToStr(const FT: _FILETIME): String;
var
  ST: SYSTEMTIME;
begin
  if FileTimeToSystemTime(FT, ST) then
    Result := TimeToStr(SystemTimeToDateTime(ST));
end;
Is das richtig so?
Es liefert mir nämlich immer 00:00:00 zurück.

turboPASCAL 24. Mär 2008 01:43

Re: _FILETIME to String
 
Wie liest du denn die Zeit ein ?

kcx 24. Mär 2008 12:22

Re: _FILETIME to String
 
Zitat:

Zitat von turboPASCAL
Wie liest du denn die Zeit ein ?

Es ist z.B die Eigenschaft "ftCreationTime" oder "ftLastAccessTime" von "WIN32_FIND_DATA".

DeddyH 24. Mär 2008 12:33

Re: _FILETIME to String
 
So funktioniert es bei mir:
Delphi-Quellcode:
function FileTimeToString(const fTime: TFileTime): string;
var sTime: TSystemTime;
begin
  Result := '';
  if FileTimeToSystemTime(fTime,sTime) then
    Result := DateTimeToStr(SystemTimeToDateTime(sTime));
end;

kcx 24. Mär 2008 12:40

Re: _FILETIME to String
 
Danke, kommt zwar das gleiche bei raus, aber dann liegt es wohl daran, das die Datei(en) keine Creation, LastAccess Zeiten (mehr) haben.

DeddyH 24. Mär 2008 12:41

Re: _FILETIME to String
 
Zitat:

Zitat von kcx
Danke, kommt zwar das gleiche bei raus, aber dann liegt es wohl daran, das die Datei(en) keine Creation, LastAccess Zeiten (mehr) haben.

Das kannst Du ja im Explorer überprüfen.

kcx 24. Mär 2008 12:53

Re: _FILETIME to String
 
Zitat:

Zitat von DeddyH
Zitat:

Zitat von kcx
Danke, kommt zwar das gleiche bei raus, aber dann liegt es wohl daran, das die Datei(en) keine Creation, LastAccess Zeiten (mehr) haben.

Das kannst Du ja im Explorer überprüfen.

Es sind Dateien von einem FTP Server.
Nur LastWriteTime wird korrekt angezeigt, bei CreationTime und LastAccessTime steht immer 01.01.1601 bzw. 00:00:00.

Bei SmartFTP wird auch nur eine Zeit angezeigt, d.h wohl, dass die anderen Zeiten nicht auf jedem FTP verfügbar sind.


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:10 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz