Thank you. This worked fine, and I could also set two breakpoint (marked * here) to see if the date format was OK.
var ADate:TDateTime;
begin
ADate:=DBGrid2.DataSource.DataSet.FieldByName('date').Value;
DateSeparator:='.';
LongDateFormat:='dd.mm.yyyy';
ShortDateFormat:='dd.mm.yyyy';
* d:=DateTimeToStr(ADate);
DateSeparator:='-';
LongDateFormat:='yyyy-mm-dd';
ShortDateFormat:='yyyy-mm-dd';
* d:=DateTimeToStr(ADate);
end;