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;

 

posted on 2021-08-06 16:45  redhat588  阅读(63)  评论(0编辑  收藏  举报