AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Datum in gültiges Datum umwandeln

Ein Thema von Tpercon · begonnen am 1. Aug 2003 · letzter Beitrag vom 2. Mär 2006
Antwort Antwort
Tpercon

Registriert seit: 7. Jun 2002
638 Beiträge
 
Delphi 5 Professional
 
#1

Datum in gültiges Datum umwandeln

  Alt 1. Aug 2003, 13:25
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.
  Mit Zitat antworten Zitat
Benutzerbild von Duffy
Duffy

Registriert seit: 19. Mär 2003
Ort: Wuppertal
835 Beiträge
 
Delphi 3 Standard
 
#2

Re: Datum in gültiges Datum umwandeln

  Alt 1. Aug 2003, 13:27
Hallo Tpercon,
StrToDateTime und FormatDateDate
bye
Künftige Generationen wollen ihre Fehler selber machen.
Jedes Programm wird nie das können, was Du wirklich brauchst.
Das Gegenteil von gut ist gut gemeint
-----
  Mit Zitat antworten Zitat
Tpercon

Registriert seit: 7. Jun 2002
638 Beiträge
 
Delphi 5 Professional
 
#3

Re: Datum in gültiges Datum umwandeln

  Alt 1. Aug 2003, 13:36
Genau bei StrtoDateTime liegt da aber das Problem, da YYYYMMDD ja kein gültiges Datumsformat ist!
  Mit Zitat antworten Zitat
Benutzerbild von Duffy
Duffy

Registriert seit: 19. Mär 2003
Ort: Wuppertal
835 Beiträge
 
Delphi 3 Standard
 
#4

Re: Datum in gültiges Datum umwandeln

  Alt 1. Aug 2003, 13:43
Hallo Tpercon,
stimmt, hier die Alternative
Delphi-Quellcode:
function YYYYDDMM2DDMMYYY(DateTimeStr: string): string;
begin
  Result := Copy(DateTimeStr, 7, 2) +
            Copy(DateTimeStr, 5, 2) +
            Copy(DateTimeStr, 1, 4);
end;
bye
Künftige Generationen wollen ihre Fehler selber machen.
Jedes Programm wird nie das können, was Du wirklich brauchst.
Das Gegenteil von gut ist gut gemeint
-----
  Mit Zitat antworten Zitat
Tpercon

Registriert seit: 7. Jun 2002
638 Beiträge
 
Delphi 5 Professional
 
#5

Re: Datum in gültiges Datum umwandeln

  Alt 1. Aug 2003, 13:46
"Diese" selbstgeschriebene Funktion benutz ich ja bisher, wollte halt wissen, ob es schon eine fertige gibt.
Trotzdem danke
  Mit Zitat antworten Zitat
Benutzerbild von Duffy
Duffy

Registriert seit: 19. Mär 2003
Ort: Wuppertal
835 Beiträge
 
Delphi 3 Standard
 
#6

Re: Datum in gültiges Datum umwandeln

  Alt 1. Aug 2003, 13:49
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
Künftige Generationen wollen ihre Fehler selber machen.
Jedes Programm wird nie das können, was Du wirklich brauchst.
Das Gegenteil von gut ist gut gemeint
-----
  Mit Zitat antworten Zitat
BennyM

Registriert seit: 7. Okt 2003
Ort: Frensdorf
24 Beiträge
 
Delphi 5 Enterprise
 
#7

Re: Datum in gültiges Datum umwandeln

  Alt 2. Mär 2006, 12:25
Hallo,

weis nicht ob das noch aktuell ist hatte aber heute das selben Problem.

Ich habe es wie folgt gelöst.

Delphi-Quellcode:
  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);
Viele Grüße

Benny
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:54 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