Autor Beitrag
O'rallY
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 563



BeitragVerfasst: Mo 17.02.03 16:04 
Gibt es eine Funktion, die zwei Datums-Typen miteindander vergleicht oder eine Funktion die z.B. die Stunden angibt, die seit was-weiß-ich-wann vergangen sind, wenn man ein Datum übergibt. So könnte man dann. Oder sogar Sekunden?

_________________
.oO'rallY
Linux is like a tipi: No gates, no windows and a gnu-eating apache inside...
DaRkFiRe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 526

WinXP Home & Professional
C, C++, Delphi
BeitragVerfasst: Mo 17.02.03 17:09 
Ich glaube, man kann die TDateiTime Variablen wie Date() und Time() einfach wie Extended-Daten-Typen benutzen - einfach subtrahieren und addieren - dann einfach per DecodeDate oder DecodeTime entschlüsseln et voilà...

_________________
Lang ist der Weg durch Lehren - kurz und wirksam durch Beispiele! Seneca
HeLe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mo 17.02.03 17:11 
die prozeduren decodedate und decodetime dürften dich wohl wunschlos glücklich machen.
ok, die vergleichen nichts, deshalb mußt du (trick 16,9) erstmal die differenz zwischen den beiden tdatetime variablen ermitteln (tdatetime ist einfach als synonym für double definiert) und dann erst das ergebnis dekodieren!

PS: Ooops, da war jemand schneller :)
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mo 17.02.03 17:17 
Hallo,

als kleine Anregung eine Funktion, die Dir die Stunden zwischen 2 Datums angibt:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
funtion Stunden(const von, bis:TDateTime):Integer;
begin
  Result:=Trunc((von-bis)*24.0);
end; // Stunden


var
  std:Integer;
  ...
  std:=Stunden(EncodeDate(2003, 2, 17)+EncodeTime(12, 0, 0, 0), now));
  ...

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
O'rallY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 563



BeitragVerfasst: Mo 17.02.03 21:10 
thx @all

_________________
.oO'rallY
Linux is like a tipi: No gates, no windows and a gnu-eating apache inside...