function StrtoDate(Astr: string): string; var D: TDateTime; s: string; begin //'20210806'转'2021-08-06' // uses System.StrUtils s := StuffString(StuffString(Astr, 5, 0, '-'), 8, 0, '-'); D := VarToDateTime(s); Result := FormatDatetime('M-dd', D); end;