Autor Beitrag
Nilsener
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26


D4
BeitragVerfasst: Fr 26.09.03 11:08 
Hallo,

ich möchte das Datum im Format tt.mm.jjjj hh.mm.ss an einen string übergeben. Im Moment mache ich das so:

ausblenden Quelltext
1:
2:
Datum := Date;
LongDateFormat:=DateTimeToStr(Datum);


Das liefert aber im String nur tt.mm.jj
Ich brauche also zusätzlich das 4stellige Jahr und die Uhrzeit.

In der Delphi Hilfe dazu verstehe ich nur Bahnhof, Frust.

Gruß Nils
datensender
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 18

Windows 2000 P / Gentoo
D5 Enterprise
BeitragVerfasst: Fr 26.09.03 11:26 
such mal nach "FormatDateTime" in der Hilfe

_________________
"...haben uns verirrt, kommen aber gut voran" (Tom DeMarco)
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: Fr 26.09.03 11:46 
Hallo,

Date liefert Dir nur das Datum. Das (aktuelle) Datum mit Uhrzeit erhälst Du mit Now. In Deinem Beispiel:

ausblenden Delphi-Quelltext
1:
2:
  Datum:=Now; 
  LongDateFormat:=DateTimeToStr(Datum);

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

Knoppix, Win 95, Win 2000, Win NT, Win 98, Win XP
Delphi 3
BeitragVerfasst: Fr 26.09.03 12:06 
Ich finde das toll.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
...
var
 Date: TDateTime;
...

FormatDateTime('YYYYMMDD',now)


Kannst alles so setzten wie du willst... Ist klasse die Funktion. :) Hier in diesem Beispiel findest du jedoch nur das Datum... Schau einfach in der Delphi Hilfe, ist echt realtiv easy. ;)
Nilsener Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26


D4
BeitragVerfasst: Fr 26.09.03 12:24 
Super, Danke Euch allen, jetzt ist es so, wie ich es haben wollte.

ausblenden Quelltext
1:
LongDateFormat:=FormatDateTime('dd.mm.yyyy  hh:mm:ss', now);					


Gruß Nils