Hi,

It's been over a year since I looked at any Object Pascal code, so a bit
rusty. [bows his head in shame] :-)

I'm maintaining a library that uses the function seen below. I any FPC
(or Lazarus) application uses this library (eg: via a lcl package).

1) Will this function change the ShortDateFormat for the whole
application, or is the scope just inside that function?

2) Is the better solution to define a local TFormatSettings, define the
ShortDateFormat for that record, and then pass that to DateToStr as the
2nd parameter?


{convert date to string with 4-digit year and 2-digit month}
function OgFormatDate(Value : TDateTime) : string;
var
  S : string;
begin
  FormatSettings.ShortDateFormat := 'yyyy-mm-dd';
  Result := DateToStr(Value);
end;





Regards,
  Graeme
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to