Einzelnen Beitrag anzeigen

Yheeky

Registriert seit: 7. Jun 2002
1.339 Beiträge
 
#15
  Alt 28. Jun 2002, 22:46
Also ich habe meine letzte Procedure überarbeitet und nun kam ich zu folgender:

Code:
public
FirstTimeDate, FirstTimeTime : Boolean;
Datum, Zeit : Integer;
Datum1, Datum2, Zeit1, Zeit2 : TDateTime;

.
.
.

procedure TForm1.SucheNeustenTermin;
var I : Integer;
begin
for I := 0 to SmartListView1.Items.Count-1 do
    begin
    Datum1 := EncodeDate(StrToInt(Copy(SmartListView1.Items[I].SubItems[1],7,4)),StrToInt(Copy(SmartListView1.Items[I].SubItems[1],4,2)),StrToInt(Copy(SmartListView1.Items[I].SubItems[1],0,2)));
    Datum2 := EncodeDate(StrToInt(Copy(DateToStr(Date),7,4)),StrToInt(Copy(DateToStr(Date),4,2)),StrToInt(Copy(DateToStr(Date),0,2)));
    Datum := Trunc(Datum1) - Trunc(Datum2);

    if Datum = 0 then
       if SmartListView1.Items.Count = 1 then
       StatusBar2.Caption := SmartListView1.Items[I].SubItems[1] + ' / ' + SmartListView1.Items[I].SubItems[2];

    if Datum > 0 then
        begin
        if FirstTimeDate = True then
        begin
        Datum1 := EncodeDate(StrToInt(Copy(SmartListView1.Items[0].SubItems[1],7,4)),StrToInt(Copy(SmartListView1.Items[0].SubItems[1],4,2)),StrToInt(Copy(SmartListView1.Items[0].SubItems[1],0,2)));
        Datum2 := EncodeDate(StrToInt(Copy(DateToStr(Date),7,4)),StrToInt(Copy(DateToStr(Date),4,2)),StrToInt(Copy(DateToStr(Date),0,2)));
        Datum := Trunc(Datum1) - Trunc(Datum2);
        NeustesDatum := IntToStr(Datum);
        end;

        Datum1 := EncodeDate(StrToInt(Copy(SmartListView1.Items[I].SubItems[1],7,4)),StrToInt(Copy(SmartListView1.Items[I].SubItems[1],4,2)),StrToInt(Copy(SmartListView1.Items[I].SubItems[1],0,2)));
        Datum2 := EncodeDate(StrToInt(Copy(DateToStr(Date),7,4)),StrToInt(Copy(DateToStr(Date),4,2)),StrToInt(Copy(DateToStr(Date),0,2)));
        Datum := Trunc(Datum1) - Trunc(Datum2);

        if SmartListView1.Items.Count = 1 then
        StatusBar2.Caption := SmartListView1.Items[I].SubItems[1] + ' / ' + SmartListView1.Items[I].SubItems[2];

        if Datum < StrToInt(NeustesDatum) then
           begin
           StatusBar2.Caption := SmartListView1.Items[I].SubItems[1] + ' / ' + SmartListView1.Items[I].SubItems[2];
           NeustesDatum := IntToStr(Datum);
           FirstTimeDate := False;
           end;

        end;

    end;

end;
Hier muss ich jetzt noch die zum nächsten Termin zugehörige Uhrzeit auslesen. Könnte mir dazu jemand Tipps geben? Wie könnte ich das machen?
Die EncodeTime Funktion funktionierte komischerweise nicht so, wie ich mir das vorgestellt habe, obwohl ich sie wie die Funktion EncodeDate angewendet habe. Als Ergebnis bekomme ich immer 0.

Gruß Yheeky
  Mit Zitat antworten Zitat