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
