Einzelnen Beitrag anzeigen

Robert_G
(Gast)

n/a Beiträge
 
#1

StrToDatetime - nicht nach Regionaleinstellungen

  Alt 18. Dez 2003, 14:14
Ich habe ein Problem mit Datumsumwandlungen.
Das Datum hat folgendes Format 'DD.MM.YYYY" - "hh:nn:ss'.
Ich habe kein Problem aus einem Datum einen so formatierten String zu extrahieren, aber andersherum funktioniert es nicht.

In Oracle (klappt in beide Richtungen):
SQL-Code:
  DT := to_date('01.01.2000 - 12:34:33', 'DD.MM.YYYY - HH24:MI:SS');
  CHR := to_char(DT, 'DD.MM.YYYY - HH24:MI:SS');
Mein Versuch in Delphi:
Delphi-Quellcode:
VAR
  DTFormat :TFormatSettings;
  CacheStr :string;
Begin
  CacheStr := '01.01.2000 - 12:34:33';
  DTFormat.DateSeparator := '.';
  DTFormat.TimeSeparator := ':';
  DTFormat.LongDateFormat := 'dd.mm.yyyy'' - ''hh:nn:ss';
  ExpHrPick.DateTime := StrToDatetime(CacheStr, DTFormat);
END;
Was mache ich falsch?
Gibt in Delphi eine Funktion, der ich das Format direkt übergeben kann (wie im oberen Bsp. ohne die regional Settings von Windows zu benutzen).
Thx im voraus...
  Mit Zitat antworten Zitat