3
votes

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.

1
What is TStudentsBirthDay? Which FireDAC component do you use? Do you use LiveBindings? - Victoria
TStudents is FireDac table , BirthDay is the field , I'm using TFDTable component , and no I'm not using LiveBindings. - Ilyes
Thanks for the info, though my question might have been pointless. I'm afraid, FireDAC is correct here, the DATE data type is in ODBC mapped to SQL_TIMESTAMP. - Victoria
@Victoria Alright , So I can't insert just the date with firedac components? is that what you try to say? - Ilyes
Try to define the field definition as be TDateField then. - Victoria

1 Answers

2
votes

Thanks for @Gerry Coll for the comment.

Using DateTimeToSQLTimeStamp() and DateOf() functions:

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

That works perfectly.