Autor Beitrag
Dhakiyah
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 327
Erhaltene Danke: 5

Windows 7
Delphi XE2
BeitragVerfasst: Fr 30.10.09 09:10 
Hallo!
Ich habe zwei TDateTimePicker. Auf Time eingestellt.
Jetzt möchte ich die eine Zeit von der anderen abziehen um die Stunden/Minuten zu ermitteln.
Wie mache ich das?

_________________
Es ist soooo flauschig !!!
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Fr 30.10.09 09:31 
ich würde sagen mit

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.foo();
var sec, min, hou, day: Int64; 
begin
  sec := SecondsBetween(Datum1, Datum2);
  min := sec div 60;
  hou := min div 60;
  day := hou div 24;
end;


damit zum beispiel ;)

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Fr 30.10.09 10:23 
ich würde sagen mit

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm1.Button7Click(Sender: TObject);
var x,z : TDateTimePicker;
begin
  x := TDateTimePicker.Create(self);
  z := TDateTimePicker.Create(self);
  x.Time := time;
  sleep(1000);
  z.Time := time;
  x.Time := z.Time - x.Time;
  ShowMessage(TimeToStr(x.Time));
  x.Free;
  z.Free;
end;


?
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Fr 30.10.09 10:28 
Stimmt, da es nur um die zeit geht und nicht um ein datum wäre das auch eine möglichkeit, hab ich nicht bedacht.

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 30.10.09 10:57 
Moin!

Und was ist, wenn während des Sleep(1000); ein neuer Tag anfängt? ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Fr 30.10.09 11:32 
och Narses das war doch nur ein simples Code beispiel ^^ soweit hab ich dabei nicht gedacht :P
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 30.10.09 11:38 
Moin!

user profile iconthepaine91 hat folgendes geschrieben Zum zitierten Posting springen:
soweit hab ich dabei nicht gedacht :P
Weiß ich doch 8) und deshalb ist user profile iconelundrils Lösung besser. ;)

cu :wave:
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Fr 30.10.09 11:45 
Hmm da sie speziell nach einem TDateTimePicker vergleich von Time gefragt hat fand ich das Beispiel auch okay :nixweiss: