Autor Beitrag
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Sa 23.09.06 15:29 
Hallo,

Ich habe ein Problem. ist klar, sonst hätte ich nicht geschrieben.

Ich habe einen String im Format ddmmyy (z.B. '120598'). Dieser stellt ein Datum dar (im Beispiel den 12. May 1998).

Nun möchte ich diese Umwandlung durchführen (also in ein TDateTime), komme aber mit dem Jahrhundert nicht klar.
(Falls jetzt Hinweise à la 'Copy() und EncodeDate' kommen, die helfen mir nicht wirklich. Soweit bin ich auch schon. Allerdings lande ich so zum Beispiel im Jahre 98, nicht 1998)

Ich hoffe ihr könnt mir helfen,
Sebastian

PS: die richtigen Suchbegriffe würden mir auch reichen, mir ist nur 'Datum ddmmyy' eingefallen^^

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
der Berliner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 417

Win Xp Home
delphi 2005
BeitragVerfasst: Sa 23.09.06 16:43 
hi...
is zwar doch mit Copy aber die Umwandlung funktioniert.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.FormShow(Sender: TObject);
Var d,d1: String;
    S: TDateTime;
begin
d:='120598';
d1:=Copy(d,1,2)+'.'+Copy(d,3,2)+'.'+Copy(d,5,2);
s:=StrToDate(d1);
ShowMessage(FormatDateTime('ddmmyyyy',s));
end;


Gruß

_________________
[b]Ich weiß nicht immer, wovon ich rede. Aber ich weiß, dass ich recht habe.[b]
Martok Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: So 24.09.06 00:48 
Genau das isses!

Ich hatte es mit EncodeDate versucht, aber das nimmt ja _genau_ das was er als Parameter kriegt.

Nochmal danke!

Martok

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: So 24.09.06 08:33 
98 ist ja auch net wirklich eindeutig :? wozu denn TTMMJJ ? warum net gleich TTMMJJJJ bzw ddmmyyyy ?
Martok Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: So 24.09.06 10:50 
Kannst ja mal die Entwickler von dem GPS-Board fragen^^

(Verrückte Amerikaner... Wer schon in Zoll rechnet, das sagt ja wohl alles.)

Naja, nicht nur Board. Da gibt es ein Protokoll namens NMEA, damit wird zum Beispiel ein ganzes Schiff verkabelt. Also Radar, GPS, Motorsteuerung usw. über einen Bus. Und da sind serielle Daten mit 4800 Baud drauf, und de parse ich. Unter anderem eben auch so ein verrücktes Datum.

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."