troubleshooting Question

Milliseconds in COleDateTime

Avatar of Rimvis
RimvisFlag for Lithuania asked on
System Programming
12 Comments1 Solution6628 ViewsLast Modified:
Hi,
is there any way to get/set millisecond values in COleDateTime?

From MSDN: "... COleDateTime objects are floating point values, with an approximate resolution of 1 millisecond."

So it is possible? But here's the sample I've tried:

.........................

COleDateTime dNow;
double fMilli;

dNow = COleDateTime::GetCurrentTime();
     
fMilli = ((fmod(dNow1.m_dt, 1.0) * 24 * 60 * 60) - (dNow1.GetHour() * 60 * 60) - (dNow1.GetMinute() * 60) - (dNow1.GetSecond())) * 1000;

.........................

Value of fMilli is always less than 0. Maybe GetCurrentTime() doesn't support milliseconds?

Then I've tried this:

..........................

CString sParse;
COleDateTime dDT;

...

dDT.ParseDateTime((LPCTSTR)sParse);
..........................

When sParse is something like "2002-08-28" or "2002-08-28 10:20:30", it's OK. But when it is "2002-08-28 10:20:30.400", COleDateTime status is changing to "invalid"


Thanx.




ASKER CERTIFIED SOLUTION
jimwasson

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros