TDateTime和String 如何让相互转换?急!

解决方案 »

  1.   

    DateTimeToStr(),StrToDateTime(),DateToStr(),StrToDate(),TimeToStr(),StrToTime(),FormatDateTime()等
      

  2.   

    DateTimeToStr(),StrToDateTime(),DateToStr(),StrToDate(),See also
      

  3.   

    用decodetime函数
    procedure TForm1.Button1Click(Sender: TObject);var
      Present: TDateTime;
      Year, Month, Day, Hour, Min, Sec, MSec: Word;
     begin
      Present:= Now;
      DecodeDate(Present, Year, Month, Day);
      Label1.Caption := 'Today is Day ' + IntToStr(Day) + ' of Month '
        + IntToStr(Month) + ' of Year ' + IntToStr(Year);
      DecodeTime(Present, Hour, Min, Sec, MSec);
      Label2.Caption := 'The time is Minute ' + IntToStr(Min) + ' of Hour '
        + IntToStr(Hour);
    end;
      

  4.   

    datetimetostr,strtodatetime Delphi 自带的函数