我想從一個字段類型為 日期/時間 型中獲取 日期怎麼處理 
例如 從 2003/6/9 am 12:30:00 獲取 2003/6/9, 獲的是日期類型的

解决方案 »

  1.   

    var
    t:TDateTIme;
    s:string;
    begin
    s:=DateToStr((TDate)t);
      

  2.   

    或者用DecodeDate
    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;
      

  3.   

    用FormatDateTime函数也可以的吧