Board index » cppbuilder » TDate and TDateTime

TDate and TDateTime


2007-01-26 11:35:07 PM
cppbuilder67
Hi all,
these data types are coming from Delphi as I could see in the Borland help.
I could see that the data type TDateTime that has the data element val from
type double.
But as I only need to have the date so I have used TDate class/type.
But in the help there is not described ahat is the type of TDate??
Normally it should be int because date in TDateTime is the integer part of
this data element.
But as I could see in my program it is still handled as double type... Why?
Cheers Marius
 
 

Re:TDate and TDateTime

"Mauro" < XXXX@XXXXX.COM >wrote in message
Quote
Hi all,

these data types are coming from Delphi as I could see in the Borland
help.

I could see that the data type TDateTime that has the data element val
from type double.
But as I only need to have the date so I have used TDate class/type.

But in the help there is not described ahat is the type of TDate??
Normally it should be int because date in TDateTime is the integer part of
this data element.
But as I could see in my program it is still handled as double type...
Why?
That is because TDate is defined using a typedef:
typedef System::TDateTime TDate;
(and so is TTime for that matter). Therefore, TDate and TDateTime are
exactly identical (different in name only). The TDateTime class provies an
"operator int()" that will give you just the date portion if that's all you
want. You can call it explicitly:
TDate mydate;
int date = mydate.operator int();
or let the compiler call it implicitly:
int date = mydate;
- Dennis
 

Re:TDate and TDateTime

"Mauro" < XXXX@XXXXX.COM >wrote in message
Quote
I could see that the data type TDateTime that has the data element
val from type double. But as I only need to have the date so I have
used TDate class/type.
TDate and TTime are just a typedefs for TDateTime:
--- Classes.hpp ---
typedef System::TDateTime TDate;
typedef System::TDateTime TTime;
Quote
But in the help there is not described ahat is the type of TDate??
Because they are all essentially identical, the TDateTime
documentation applies to all three types.
Quote
Normally it should be int because date in TDateTime is the
integer part of this data element. But as I could see in my
program it is still handled as double type... Why?
Because TDate is not a separate type.
Gambit
 

{smallsort}