[fpc-devel] TimeReFormat in FormatDateTime

Michael Van Canneyt michael at freepascal.org
Tue Apr 8 16:32:30 CEST 2008



On Tue, 8 Apr 2008, petr.kristan at epos.cz wrote:

> I do no know exact reason use TimeReFormat (replacing 'm'->'n' in time
> formating). But we cannot use this, because this breaks 'am/pm' and 'ampm' formating request.
> And we get 'Illegal character in format string'.
> 
> Here is little patch, which disables this behaviour.

It should not be disabled, but fixed properly. 
This code is there for a reason:

Normal time formatting is hh:nn (n = minutes). But Delphi explicitly
allows also hh:mm for time, even though mm is the placeholder for month.

Michael.

> 
> Index: objpas/sysutils/dati.inc
> ===================================================================
> --- objpas/sysutils/dati.inc    (revision 10597)
> +++ objpas/sysutils/dati.inc    (working copy)
> @@ -569,13 +569,13 @@
>  
>     Function TimeReFormat(Const S : string) : string;
>     // Change m into n for time formatting.
> -   Var i : longint;
> +   //Var i : longint;
>  
>     begin
>       Result:=S;
> -     For I:=1 to Length(Result) do
> +     {For I:=1 to Length(Result) do //We cannot do that am/pm does not then work
>         If Result[i]='m' then
> -         result[i]:='n';
> +         result[i]:='n';}
>     end;
>  
>  var
> 
> 
> Petr
> 
> -- 
> Ing. Petr Kristan
> .
> EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice
> tel: +420 466335223    Czech Republic (Eastern Europe) 
> fax: +420 466510709
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 



More information about the fpc-devel mailing list