Autor Beitrag
XPert
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 129

Windows 98/00/Me/XP
D6 Pers
BeitragVerfasst: So 05.10.03 07:04 
hi leutz,

ich habe ein kleies problem... haben wir hier nicht alle immer welche?^^ na egal.

ich lasse aus zwei ini-dateien jeweils einen wert auslesen. beide strings haben folgendes format: tt.mm.yyyy (z.B.: 01.10.2003) wie kann ich nun vergleichen, welcher string neuer (größer) im wert ist?

_________________
MfG Fabian Schweers :lol:
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: So 05.10.03 08:52 
Hi,

das doch wirklich leicht :)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
IF datum1 < datum2 THEN
 BEGIN
  Showmessage('datum2');
 END;

IF datum1 > datum2 THEN
 BEGIN
  Showmessage('datum1');
 END;

IF datum1 = datum2 THEN
 BEGIN
  Showmessage('gleich');
 END;


:twisted:
XPert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 129

Windows 98/00/Me/XP
D6 Pers
BeitragVerfasst: So 05.10.03 09:40 
danke! ich wusste gar nciht, dass man strings, wie "23.03.1988" mit den operator < und > und = und dem zweiten string "25.12.1958" vergleichen usw. kann... ist ja witzig...

_________________
MfG Fabian Schweers :lol:
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: So 05.10.03 10:18 
wird auch nicht ganz funktionieren! Zuerst musst die die Stringdaten via StrToDate() umwandeln. Ansonsten ist die Abfrage nach Alpha und nicht nach wert. Schau mal in der OH unter Datum vergleichen nach, gibt bereits fertige Routinen.
grez
msch

_________________
ist das politisch, wenn ich linksdrehenden Joghurt haben möchte?
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: So 05.10.03 10:27 
Hi,

eigendlich sollte es auch so gehen wie ichs gemacht hab. Zumindest laut Büchern (ich weiß die Titel nicht mehr) die ich letztens noch gelesen hab.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: So 05.10.03 10:44 
@BungeeBug: Es kommt darauf an, wie man die Daten (Plural von Datum) aus der Ini ausliest. Nimmt man
ausblenden Delphi-Quelltext
1:
2:
datum1:=myini.readstring(section,Datum1,'');
datum2:=myini.readstring(section,Datum2,'');
,
dann hat man zwei Strings, die man vergleichen kann. Das Sortierkriterium is da natürlich das Alphabet.
Is man aber schlau, dann nimmt man
ausblenden Delphi-Quelltext
1:
2:
datum1:=myini.readdate(section,Datum1,0);
datum2:=myini.readdate(section,Datum2,0);
, dann hat man zwei Daten, die mit >,<,= auf später,früher oder gleich getestet werden.

_________________
We are, we were and will not be.