Search code examples
delphims-accessdelphi-10-seattlefiredac

Insert just the date to MS access database using FireDac


I have a table called Students , in this table there is a date column called BirthDay with Date, abbreviated format (eg : 26/06/2017), the problem is in delphi the Field type is SQLTimeStamp, and I want to save just the Date not a DateTime.

DM.TStudentsBirthDay.Value := DateTimeToSQLTimeStamp(DateTimePicker1.Date);

That will post a DateTime.

How can I fix this? How can I insert just the date?

Update :

I try to do it with TFDQuery component and it works perfectly , also with TAODTable component.


Solution

  • Thanks for @Gerry Coll for the comment.

    Using DateTimeToSQLTimeStamp() and DateOf() functions:

    DM.TStudentsBirthDay.Value := DateTimeToSQLTimeStamp(DateOf(DateTimePicker1.Date));
    

    That works perfectly.