Datum in gültiges Datum umwandeln
Ich lese aus einer txt Datei ein Datum in der Form YYYYMMDD aus. Gibt es eine fertige Funktion die das in das Format DDMMYYYY bringt? Bisher zerleg ich mir das selbst und stell es wieder zusammen.
|
Re: Datum in gültiges Datum umwandeln
Hallo Tpercon,
StrToDateTime und FormatDateDate bye |
Re: Datum in gültiges Datum umwandeln
Genau bei StrtoDateTime liegt da aber das Problem, da YYYYMMDD ja kein gültiges Datumsformat ist!
|
Re: Datum in gültiges Datum umwandeln
Hallo Tpercon,
stimmt, hier die Alternative
Delphi-Quellcode:
bye
function YYYYDDMM2DDMMYYY(DateTimeStr: string): string;
begin Result := Copy(DateTimeStr, 7, 2) + Copy(DateTimeStr, 5, 2) + Copy(DateTimeStr, 1, 4); end; |
Re: Datum in gültiges Datum umwandeln
"Diese" selbstgeschriebene Funktion benutz ich ja bisher, wollte halt wissen, ob es schon eine fertige gibt.
Trotzdem danke |
Re: Datum in gültiges Datum umwandeln
Hallo
schau ma lhier nach, vieleicht findest Du was ... ESBDates™ v3.0.1 - Collection of over 275 Date & Time Routines for Borland® Delphi™ to supplement those supplied by SysUtils. Includes TimeZone (incl RFC822 support) Calculations, Date Arithmetic, Week Number Calculations, Easter Calculations, ISO-8601 Compliant Routines etc. Includes Primoz Gabrijelcic's GpTimeZone routine collection. Designed for Delphi™ 4, 5 & 6, but should work with Delphi™ 2 & 3 and C++ Builder™ 4 & 5. Includes Help File and Full Source. Freeware. bye |
Re: Datum in gültiges Datum umwandeln
Hallo,
weis nicht ob das noch aktuell ist hatte aber heute das selben Problem. Ich habe es wie folgt gelöst.
Delphi-Quellcode:
Viele Grüße
var
Datum : String; Datum_neu : TDateTime; ... //Erst ShortDateFormat und DateSeperator setzen Datum := '2006-01-01 10:00:00'; ShortDateFormat := 'yyyy-mm-dd'; DateSeparator := '-'; Datum_neu := StrToDateTime(Datum); Benny |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:20 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz