Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

COleDateTime

0 views
Skip to first unread message

msm...@tiac.net

unread,
May 3, 1997, 3:00:00 AM5/3/97
to

What is the best way to calculate x number of days from a COleDateTime
member??

I started to think that if I could convert the COleDateTime to a DATE
which it does say you can do I figured I could just add 7 or 5 or
whatever number of days that I wanted to add and then create a new
COleDateTime member with the new DATE.

However I have not figured out how to use this function of the class
Here it is from the help files ......

operator DATE( ) const;

Remarks
This operator returns a DATE object whose value is copied from this
COleDateTime object.
For more information about the implementation of the DATE object, see
the article Date and Time: OLE Automation Support in Programming with
MFC.

I am familiar with overriding operator = type stuff but not this one
yet

send mail to msm...@tiac.net

thanks

Harley Jackson

unread,
May 4, 1997, 3:00:00 AM5/4/97
to


msm...@tiac.net wrote in article <5kg887$n...@news-central.tiac.net>...

Use a COleDateTimeSpan (subtract req'd date from today's date) and use its
GetDays() function.

HTH
Harley

Peter Persits

unread,
May 5, 1997, 3:00:00 AM5/5/97
to

DATE is really just the double data type. It represents the number of days
since Dec. 30, 1889. To create a new COleDateTime object with is the
result of adding 5 days to another COleDateTime object, simply say

COleDateTime t, * pNew;
...
pNew = new COleDateTime( (DATE)t + 5 );

Rosa Bernárdez Rodríguez

unread,
May 7, 1997, 3:00:00 AM5/7/97
to

msm...@tiac.net wrote:

>
.......

> However I have not figured out how to use this function of the class
> Here it is from the help files ......
>
> operator DATE( ) const;

........


> I am familiar with overriding operator = type stuff but not this one
> yet
>
> send mail to msm...@tiac.net

This is the cast operator. You can override the cast to
get diffent types. This is an example:

COleDateTime hour;

DATE d_hour=(DATE)hour; // in this line you are using the cast operator

0 new messages