Board index » delphi » Access DateTime data type problem?

Access DateTime data type problem?

Hello,
    in MSACCESS 97, I have a table with date field, and the data in the
table shows me correctly, but not so correct in delphi, why?
in MSACCESS, the InvoiceDate is '1998/11/11', but in delphi, the value is
'1998/11/11 pm 15:xx:xx', how can I resolve it?
I use DBDateTimePicker to assign the date value in delphi.
thank you!
David Ting
 

Re:Access DateTime data type problem?


David Ting heeft geschreven in bericht <72hepl$f8...@forums.borland.com>...

Quote
>Hello,
>    in MSACCESS 97, I have a table with date field, and the data in the
>table shows me correctly, but not so correct in delphi, why?
>in MSACCESS, the InvoiceDate is '1998/11/11', but in delphi, the value is
>'1998/11/11 pm 15:xx:xx', how can I resolve it?
>I use DBDateTimePicker to assign the date value in delphi.
>thank you!
>David Ting

Hello David,

Access 97 only supports the DateTime field, and stores both date and time in
one field. I don't know the DBDateTimePicker component, but I do know the
TDateTimePicker component, that is NOT data-aware.  If you are using this
component and are assigning is values to a datetime field in your access
table, then try referring to the date property rather then to the datetime
property of the TDateTimePicker.  This way the time part is not filled and
will be ignored in date calculations

Hope this helps...
nospamGermW...@gironet.nl

Re:Access DateTime data type problem?


Quote
>Hello David,

>Access 97 only supports the DateTime field, and stores both date and time
in
>one field. I don't know the DBDateTimePicker component, but I do know the
>TDateTimePicker component, that is NOT data-aware.  If you are using this
>component and are assigning is values to a datetime field in your access
>table, then try referring to the date property rather then to the datetime
>property of the TDateTimePicker.  This way the time part is not filled and
>will be ignored in date calculations

First of all, thank you for your reply.
I downloaded a component named TDBDateTimePicker, which is the same as the
TDateTimePicker, except, it is a data-awre component. Also I have set the
date property rather than to the datetime property of the TDBDateTimePicker,
but it seems doesn't work.
Do you think it will work if I set the DisplayFormat property in the fields
editor?

Re:Access DateTime data type problem?


David Ting heeft geschreven in bericht <72k6nk$i...@forums.borland.com>...

Quote

>First of all, thank you for your reply.
>I downloaded a component named TDBDateTimePicker, which is the same as the
>TDateTimePicker, except, it is a data-awre component. Also I have set the
>date property rather than to the datetime property of the
TDBDateTimePicker,
>but it seems doesn't work.
>Do you think it will work if I set the DisplayFormat property in the fields
>editor?

Hi David,

Best solution is, of course to get the source code and change it :). Another
way out of it is the following: the TDateTime type is a Double. The Integer
part represents the date, the Fraction represents the time. All you need to
do in your app is to take the integer part of the de datetime (for example
int(table.FieldByName('DateTimeField').asDateTime), and you have the date
left. The time is set to 00:00. I hope this works out for you...

Germ Wind

Re:Access DateTime data type problem?


thank you, I will give a try

Regards,
David Ting

Germ Wind ???g??31 <72l0hl$jv...@forums.borland.com>...

Quote

>David Ting heeft geschreven in bericht <72k6nk$i...@forums.borland.com>...

>>First of all, thank you for your reply.
>>I downloaded a component named TDBDateTimePicker, which is the same as the
>>TDateTimePicker, except, it is a data-awre component. Also I have set the
>>date property rather than to the datetime property of the
>TDBDateTimePicker,
>>but it seems doesn't work.
>>Do you think it will work if I set the DisplayFormat property in the
fields
>>editor?

>Hi David,

>Best solution is, of course to get the source code and change it :).
Another
>way out of it is the following: the TDateTime type is a Double. The Integer
>part represents the date, the Fraction represents the time. All you need to
>do in your app is to take the integer part of the de datetime (for example
>int(table.FieldByName('DateTimeField').asDateTime), and you have the date
>left. The time is set to 00:00. I hope this works out for you...

>Germ Wind

Other Threads