to use it in CalcXPosValue(somedouble_from_datetime)?
I saw the way to do it in Delphi by 'EncodeDate()' function, but how about VC++?
Any ideas would be gretly appreciated. Thanks.
Igor.
How to convert datetime to double VC++ in order
Hi,
in VC++, TeeChart uses a COleDateTime object to define datetime, e.g.
COleDateTime datevalue;
datevalue = COleDateTime(doublevalue);
in VC++, TeeChart uses a COleDateTime object to define datetime, e.g.
COleDateTime datevalue;
datevalue = COleDateTime(doublevalue);
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi,
Thank you for reply. But actually I need a reverse operation to be done - get a double from COleDateTime. I have my bottom axes as of date type. And I need to know a real coordinates those correspond to certain dates on bottom axes. To achive this I guess I need to use function CalcXPos(double). So I need that certain date on bottom axes to be coverted in double in order to use it in CalcXPos function. Any ideas?
Thanks.
Thank you for reply. But actually I need a reverse operation to be done - get a double from COleDateTime. I have my bottom axes as of date type. And I need to know a real coordinates those correspond to certain dates on bottom axes. To achive this I guess I need to use function CalcXPos(double). So I need that certain date on bottom axes to be coverted in double in order to use it in CalcXPos function. Any ideas?
Thanks.
Hi,
how about using DOUBLE(x):
DoubleValue = DOUBLE(COleDateTimeValue);
?
how about using DOUBLE(x):
DoubleValue = DOUBLE(COleDateTimeValue);
?
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi,
Actually I did not find that macro DOUBLE(x) in VC++ documentation, but on the other hand it gace me an idea and below is how I solved my conversion problem via ChangeType function:
However it seems converted it not exactly to the double which was used by chart when building Bottom axis datevalue for that date. So I should devide it by 100 to get some approximate coordinate to what is really needed. But still it's not the exact value. Have you an idea how to get exact value which exactly corresponds to the coordinate on bottom axis?
Thank you again for your time.
Actually I did not find that macro DOUBLE(x) in VC++ documentation, but on the other hand it gace me an idea and below is how I solved my conversion problem via ChangeType function:
Code: Select all
COleVariant oleDateVar;
oleDateVar.ChangeType(VT_DATE);
COleDateTime oleDate(nYear, nMonth, nDay, 12, 0, 0);
oleDateVar = oleDate;
oleDateVar.ChangeType(VT_R8);
nDoubleDateValue = V_R8(&oleDateVar);
long nX = cBottomAxis.CalcXPosValue(nDoubleDateValue/100.0);
Thank you again for your time.