Autor Beitrag
SebastianDamm
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Di 21.10.08 13:29 
Hallo zusammen!
Ich stehe vor folgendem Problem. Ich lese Dateien ein und füge deren Inhalt in eine Datenbank ein. Leider haben die Dateien eine Datumszeile mit unterschiedlichsten Datumsformate (z.B.: dd.mm.yy oder yy/mm/dd oder mm-dd-yy etc.). Es steht allerdings in jeder Datei, wie das Datumsformat für die Datei aussieht.
Nun will ich meiner Datumsvariablen die richtigen Werte zuordnen ("Datum:=EncodeDate(yy,mm,dd);"), woran ich allerdings momentan scheitere. Variable Variablennamen gibts in Delphi so weit ich weiß nicht, sonst hätte ich das Datumsformat eingelesen und entsprechend dann die Werte zugeordnet. Irgendjemand eine Idee wie ich das Problem in den Griff bekommen könnte?
Gruß,
Sebastian
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Di 21.10.08 14:26 
bastele dir mit stringreplace das delphi-konforme datum
LexXis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 170
Erhaltene Danke: 3



BeitragVerfasst: Di 21.10.08 16:13 
Problematisch wird es dabei wenn "12/03/08" da steht. Könnte 12.03.2008 sein, aber eben auch 08.03.2012 usw usf..

mfg
Hobby-Programmierer
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 238
Erhaltene Danke: 4

Win XP Pro, Vista Ultimate Trial :o)
D6 Pro, D7 Pro, Turbo, XE SE
BeitragVerfasst: Di 21.10.08 18:42 
user profile iconLexXis hat folgendes geschrieben Zum zitierten Posting springen:
Problematisch wird es dabei wenn "12/03/08" da steht. Könnte 12.03.2008 sein, aber eben auch 08.03.2012 usw usf..
mfg

... Datumsformat ist doch jeweils bekannt! Oder habe ich mich da verlesen?
Ich hatte dafür mal ne einfache Routine zum parsen hier im Forum gepostet. Bin nur zu faul zum suchen ...

Gruss Mario


Zuletzt bearbeitet von Hobby-Programmierer am Di 21.10.08 19:17, insgesamt 1-mal bearbeitet
LexXis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 170
Erhaltene Danke: 3



BeitragVerfasst: Di 21.10.08 18:51 
user profile iconHobby-Programmierer hat folgendes geschrieben Zum zitierten Posting springen:

... Datumsformat ist doch jeweils bekannt! Oder habe ich mich da verlesen?


Oh, sry. Glatt überlesen :oops:
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: Di 21.10.08 19:08 
Hier gibt's einen Datumsparser von user profile iconbaka0815. Ich denke, das ist genau das, was du suchst. :)