I have a TDateTime variable called currMonth. currMonth's value is "6/30/2000 11:59:59 PM". I need to insert currMonth as default value for a field at TDBGrid called dtBegin.
I try this code :
dtBegin->AsDateTime = currMonth;
And the compiler is succeed compiling the project, but when I debug it, I get dtBegin value is not "6/30/2000 11:59:59 PM" but { 36738.9999999884 }.
Anyone know whats wrong with this TDateTime object?
Thanks in advance.
There are numerous replies to your same question that you posted on the Embarcadero forum at the same time you posted here.
In a nutshell, there is nothing wrong at all.
TDateTimeis implemented as adoubleinternally. The debug inspector is merely showing you thatdoublevalue as-is, not a formatted date/time string that you are expecting. This is normal behavior, and yourTDateTimeitself will work fine in your code. You are using an older version of C++Builder, so you do not have theTDateTimedebug visualizer that newer versions of C++Builder have for displayingTDateTimevalues nicer, that's all.If you need to see the
TDateTimevalue in a formatted manner inside the debugger, you will have to define an entry in the Watch List that calls the RTL'sDateTimeToStr()function, or theTDateTime::FormatString()method, and displays the result to you.