Browse Source

Fix for Mantis #24929.

rtl/sysutils/datih.inc:
  + add StrToDate overload which allows passing of specific TFormatSettings parameter
rtl/sysutils/dati.inc:
  * implement new StrToDate overload by calling IntStrToDate similar to StrToTime

git-svn-id: trunk@25392 -
svenbarth 12 years ago
parent
commit
b288179d56
2 changed files with 10 additions and 0 deletions
  1. 9 0
      rtl/objpas/sysutils/dati.inc
  2. 1 0
      rtl/objpas/sysutils/datih.inc

+ 9 - 0
rtl/objpas/sysutils/dati.inc

@@ -502,6 +502,15 @@ begin
     Raise EConvertError.Create(Msg);
 end;
 
+function StrToDate(const S: string; FormatSettings: TFormatSettings): TDateTime;
+var
+  Msg: AnsiString;
+begin
+  Result:=IntStrToDate(Msg,@S[1],Length(S),FormatSettings.ShortDateFormat,FormatSettings);
+  if Msg<>'' then
+    raise EConvertError.Create(Msg);
+end;
+
 function StrToDate(const S: ShortString; const useformat : string; separator : char = #0): TDateTime;
 begin
     result := StrToDate(@S[1],Length(s),UseFormat,separator);

+ 1 - 0
rtl/objpas/sysutils/datih.inc

@@ -125,6 +125,7 @@ function StrToDate(const S: ShortString): TDateTime;                  {$ifdef SY
 function StrToDate(const S: Ansistring): TDateTime;                   {$ifdef SYSUTILSINLINE}inline;{$endif}
 function StrToDate(const S: ShortString; separator : char): TDateTime;{$ifdef SYSUTILSINLINE}inline;{$endif}
 function StrToDate(const S: AnsiString; separator : char): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
+function StrToDate(const S: string; FormatSettings : TFormatSettings): TDateTime;
 function StrToTime(const S: Shortstring): TDateTime;                  {$ifdef SYSUTILSINLINE}inline;{$endif}
 function StrToTime(const S: Ansistring): TDateTime;                   {$ifdef SYSUTILSINLINE}inline;{$endif}
 function StrToTime(const S: ShortString; separator : char): TDateTime;{$ifdef SYSUTILSINLINE}inline;{$endif}