Autor Beitrag
Chrischuh
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 124
Erhaltene Danke: 1

Win 7
Turbo Delphi
BeitragVerfasst: Fr 21.12.07 19:41 
Hallo,

ich möchte eine in ein edit eingetragene Uhrzeit mit der jetzigen Zeit vergleichen.
Dazu muss ich aber string-Variable in eine Datum-variable umwandeln. Wie mache ich das?
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Fr 21.12.07 20:30 
ausblenden Delphi-Quelltext
1:
StrToDate();					


Hätte man auch selber drauf kommen können :D

Edit:
Äh, ok, da war ich zu schnell..
meinte
ausblenden Delphi-Quelltext
1:
StrToDateTime();					


Zuletzt bearbeitet von Xentar am Fr 21.12.07 20:33, insgesamt 1-mal bearbeitet
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Fr 21.12.07 20:31 
ausblenden Delphi-Quelltext
1:
2:
3:
Date := StrToDateTime(Edit1.Text);
Diff := Now-Date;
ShowMessage(FormatDateTime('hh:nn:ss', Diff)+' Stunden sind verstrichen.');


Du kannst aber auch andere Formatierungen für FormatDateTime benutzen, siehe die Online-Hilfe für Delphi.
Wolle92
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Fr 21.12.07 20:35 
user profile iconYogu hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
Date := StrToDateTime(Edit1.Text);
Diff := Now-Date;
ShowMessage(FormatDateTime('hh:nn:ss', Diff)+' Stunden sind verstrichen.');


Du kannst aber auch andere Formatierungen für FormatDateTime benutzen, siehe die Online-Hilfe für Delphi.


Naja, eher ShowMessage(FormatDateTime('hh:mm:ss', Diff)+' Stunden sind verstrichen.');

_________________
1405006117752879898543142606244511569936384000000000.
LorenzS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

MS-DOS, WIN 7, WIN 10
BP7.0, D3, D5
BeitragVerfasst: Fr 21.12.07 20:48 
ausblenden Delphi-Quelltext
1:
howMessage(FormatDateTime('hh:nn:ss', Diff)+' Stunden sind verstrichen.');					

war doch richtig! laut hilfe ist n = minute und m=monat und zzz = millisekunden
Wolle92
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Fr 21.12.07 21:02 
OK...

_________________
1405006117752879898543142606244511569936384000000000.