Einzelnen Beitrag anzeigen

nahpets
(Gast)

n/a Beiträge
 
#5

AW: DateTime JJMMTT umwandeln in TTMMJJ

  Alt 6. Mär 2017, 11:58
In Delphi 7 gibt es function StrToDateTime(const S: string; const FormatSettings: TFormatSettings): TDateTime; und function FormatDateTime(const Format: string; DateTime: TDateTime; const FormatSettings: TFormatSettings): string; Also bitte entsprechendes Formatsetting definieren und dann sowas aufrufen:
Delphi-Quellcode:
var
          fs : TFormatSettings;
          Datum : String;
begin
  GetLocaleFormatSettings(LOCALE_SYSTEM_DEFAULT,fs);
  // Entsprechend Deinen Anforderungen anpassen!
  fs.ShortDateFormat := 'DDMMYY';
  fs.ShortTimeFormat := 'hh:mm';
...
  Datum := FormatDateTime(StrToDateTime('170126 09:20',fs),'YYYYMMDD');
...
Zitat von Back2Code:
ich habe hier einen DateTime String im Format "JJMMTT" [170126:0920]: welchen ich gerne in folgendes Format "YYYYMMDD" [26.01.2017:09:20:00]
Die verbalen Beschreibungen passen nicht zu den Beispielen.
  Mit Zitat antworten Zitat