Datetime precision loss
Posted: Wed Feb 13, 2008 10:15 pm
I've noticed when I add Datetimes into a series there is a precision loss. Anything less then a millisecond seems to get thrown away. Here's an example of the problem using C# .Net
axTChart1.Series(0).XValues.DateTime = true;
DateTime dt = DateTime.Now;
double val = new Random().NextDouble();
axTChart1.Series(0).Clear();
axTChart1.Series(0).AddXY(dt.ToOADate(), val, "", 0);
double chartVal = axTChart1.Series(0).XValues.get_Value(0);
DateTime chartDT = DateTime.FromOADate(chartVal);
if (chartDT != dt)
MessageBox.Show("Not equal");
if (chartDT == new DateTime(dt.Year,dt.Month,dt.Day,dt.Hour,dt.Minute,dt.Second,dt.Millisecond))
MessageBox.Show("Equal");
Best regards,
Jerron
axTChart1.Series(0).XValues.DateTime = true;
DateTime dt = DateTime.Now;
double val = new Random().NextDouble();
axTChart1.Series(0).Clear();
axTChart1.Series(0).AddXY(dt.ToOADate(), val, "", 0);
double chartVal = axTChart1.Series(0).XValues.get_Value(0);
DateTime chartDT = DateTime.FromOADate(chartVal);
if (chartDT != dt)
MessageBox.Show("Not equal");
if (chartDT == new DateTime(dt.Year,dt.Month,dt.Day,dt.Hour,dt.Minute,dt.Second,dt.Millisecond))
MessageBox.Show("Equal");
Best regards,
Jerron