FieldByName('CallTime1').Value := DateTimeToStr(dtpTime1.Time);然后提交,但是写进去的是 日期+时间 格式。我又试了好几种途径,始终没有进展。请问有哪位知道如何取Datetimepicker时间(时分秒)进Access数据库的。先谢过。

解决方案 »

  1.   

    看看delphi帮助
    1、function TimeToStr(Time: TDateTime): string; overload;
    2、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;
      

  2.   

    对 还有l楼说的FormatDateTime;这些多是对TDateTime处理常用的函数
      

  3.   

    FieldByName('CallTime1').Value :=formatdatetime('HH:MM:SS',dtpTime1.date);
      

  4.   

    FormatDateTime 我试过了,无论如何转换,存进数据库的还是日期+时间格式。
    TimeToStr我也试过了,没有成功。
    分解日期的方法我有想过,觉得有些麻烦
      

  5.   

    这个也不影响你程序调用啊 
    你在外部调用的时候 
    加个FormatDateTime 就可以了啊
      

  6.   

    formatdatetime('yyyy-mm-dd',DateTimePicker1.date)
      

  7.   

    我已经明白了,Access如果用日期/时间类型的字段,总是显示日期和时间都有的。
    那么我调用的时候转换一下就可以了。
    谢谢jiffChung,还有genispan