hi, I have the following problem, I working with the variable "COleDateTime".
I have the following code:

DATE CurrentTime = COleDateTime::GetCurrentTime();

This returns the current time of the system
Do you know how to add to this current time seconds, minutes, days?
Also I need to get two dates and make some actions, How many seconds, days.. pass('+', '-'),
Ideas?
:eek:
Thanks

Recommended Answers

All 4 Replies

read this article, and this one about DATE data type

Thanks but it wasn't wht I'm looking for
I try the following

DATE MyTime = COleDateTime::GetCurrentTime();    
COleDateTimeSpan  MyDiff = CurrentTime;
//Convert the seconds to milliseconds 
DWORD Milliseconds = ( timeDiff.GetSeconds() * 1000);    
Milliseconds = Milliseconds + 10000;

I try to add '10000' milliseconds to the value that pass, but when I set the value "Milliseconds", I think the value is too big and I receive a smaller value that is smaller.
What I can do?
I really need your help

COleDateTime() does not handle milliseconds. If you add milliseconds to the DATE object you will invalidate the COleDateObject -- at least that was my experience with it. I had to subclass the COleDateTime class and handle the milliseconds myself.

And why would you want to add 10,000 milliseconds ?

The DATE type is implemented using an 8-byte floating-point number. Days are represented by whole number increments starting with 30 December 1899, midnight as time zero. Hour values are expressed as the absolute value of the fractional part of the number

The value to the right of the decimal point represents the fraction of the hour minutes and seconds, note that milliseconds are not included. For example:

30 December 1899, midnight  = 0.00 
4 January 1900, 6 A.M.  = 5.25 (5 days past 30 Dec 1899)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.