Autor Beitrag
michaelarban
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Di 17.07.12 10:45 
hallo,

ich habe folgende Funktion, die mir aus 01.02.12 (also 1.Februar 2012) den 01.02.2012 machen soll,

stattdessen bekomme ich jedoch 01.02.5248

weiß jemand rat?

Danke

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
function Datum(pDatum : String; pTrenner: Char; out pOutDatum: String): Boolean;
var
  lvFormatSettings: TFormatSettings;
  lvDate  : TDateTime;
begin
  result  := true;
  pOutDatum := '';

  lvFormatSettings.ShortDateFormat := 'dd.mm.yyyy';
  lvFormatSettings.LongDateFormat := 'dd.mm.yyyy';
  lvFormatSettings.DateSeparator  := '.';

  lvDate  := StrToDate(pDatum, lvFormatSettings);  
  pOutDatum := DateToStr(lvDate, lvFormatSettings);
end;


Moderiert von user profile iconNarses: Code- durch Delphi-Tags ersetzt
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Di 17.07.12 10:57 
kann ich nicht nachvollziehen, wie wäre es mit sowas?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
Function GetMyDate(const ins:String):String;
var
 d:TDateTime;
begin
  if TryStrToDate(ins,d) then
    Result := FormatDateTime('dd.mm.yyyy',d)
  else Result := ins;
end;

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
michaelarban Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Di 17.07.12 11:05 
Hallo bummi,

danke funktioniert.

bye