Page 1 of 1

Date/Time field dropping time value after .post

Posted: Sat 06 Feb 2016 20:07
by sbsllc
Hi All,

I am using version 8.6.21 along with Delphi XE3.
When I post a value to a date/time field the time value seems to drop off.

The code looks something like this:
mysqlqry.Append;
mysqlqry.FieldByName('datefield').AsDateTime := Now;
mysqlqry.Post;

So right before the post the value in mysqlqry.FieldByName('datefield').AsDateTime is 2/6/2016 2:06:19 PM but right after posting it 2/6/2016.

Thanks

Re: Date/Time field dropping time value after .post

Posted: Fri 12 Feb 2016 14:14
by ViktorV
The DATE server type allows to store only date, TIME - only time. Therefore, on execution of your code, the DATE field will store only current date. To store a date-time value, you should use the DATETIME or TIMESTAMP server types.

Re: Date/Time field dropping time value after .post

Posted: Sat 13 Feb 2016 02:09
by sbsllc
The server field type is DATETIME.

Re: Date/Time field dropping time value after .post

Posted: Mon 15 Feb 2016 14:13
by ViktorV
Unfortunately, we couldn't reproduce the issue: when executing your code, correct data and time were saved to a DATETIME field. To investigate the issue, please compose a small sample demonstrating the described behavior and send it to us, including scripts for creating database objects.