如何将datetimepicker delphi 7转换成大写

function NumToCStr(Num: Integer): String;
begin
  ReSult := '';
  case Num of
       0: ReSult := '零';
       1: ReSult := '壹';
       2: ReSult := '贰';
       3: ReSult := '叁';
       4: ReSult := '肆';
       5: ReSult := '伍';
       6: ReSult := '陆';
       7: ReSult := '柒';
       8: ReSult := '捌';
       9: ReSult := '玖';
      10: ReSult := '拾';
      11: ReSult := '拾壹';
      12: ReSult := '拾贰';
      13: ReSult := '拾叁';
      14: ReSult := '拾肆';
      15: ReSult := '拾伍';
      16: ReSult := '拾陆';
      17: ReSult := '拾柒';
      18: ReSult := '拾捌';
      19: ReSult := '拾玖';
      20: ReSult := '贰拾';
      21: ReSult := '贰拾壹';
      22: ReSult := '贰拾贰';
      23: ReSult := '贰拾叁';
      24: ReSult := '贰拾肆';
      25: ReSult := '贰拾伍';
      26: ReSult := '贰拾陆';
      27: ReSult := '贰拾柒';
      28: ReSult := '贰拾捌';
      29: ReSult := '贰拾玖';
      30: ReSult := '叁拾';
      31: ReSult := '叁拾壹';
  end;
end;

{在Button的OnClick 事件中输入以下代码}
procedure TForm1.Button1Click(Sender: TObject);
var
  SYear,SMonth,SDay,tmpYear: String; i: Integer;
begin
  SYear := FormatDateTime('YYYY',DateTimePicker1.Date);
  SMonth := FormatDateTime('MM',DateTimePicker1.Date);
  SDay := FormatDateTime('DD',DateTimePicker1.Date);
  tmpYear := '';
  for i := 0 to Length(SYear) do begin
      if SYear[i] in ['0','1','2','3','4','5','6','7','8','9'] then
      tmpYear := tmpYear + NumToCStr(StrToInt(SYear[i]));
  end;
  Edit1.Text := tmpYear + '年' + NumToCStr(StrToInt(SMonth)) +
  '月' + NumToCStr(StrToInt(SDay)) + '日';
end;

你可能感兴趣的:(如何将datetimepicker delphi 7转换成大写)