C++ Topics and Explanations
Re: Handling Date Functions

[ Follow Ups ] [ Post Follow Up ] [ C++ Topics and Explanations ]

Posted by Caio Proiete on December 14, 203 at 16:26:40:

In Reply to: Re: Handling Date Functions posted by Pete on December 12, 203 at 02:51:26:

I'm glad my sample was useful!
You're welcome ;)

Caio Proiete


: Thank you tons for your example.. worked "out of the box" for me.

: Pete

: : Hi Nitin,

: : The CTime class doesn't provide any functions capable of doing that. You have to use the COleDateTime::ParseDateTime function and then fill your CTime object...

: : Sample:
: : COleDateTime objCOleTime;
: : // Try parsing the date value
: : objCOleTime.ParseDateTime("March 16,2003", VAR_DATEVALUEONLY);

: : // String date was valid?
: : if (objCOleTime.GetStatus() == COleDateTime::valid)
: : {
: : // Creates a CTime object from COleDateTime object
: : CTime objCTime(objCOleTime.GetYear(), objCOleTime.GetMonth(),
: : objCOleTime.GetDay(), objCOleTime.GetHour(),
: : objCOleTime.GetMinute(), objCOleTime.GetSecond());

: : }

: : cheers,

: : Caio Proiete

: :
: : : Hello,

: : : We Can convert CTime object to string using CTime::CurrentTime.Format("%B %d, %Y").
: : : But How can I convert from String to CTime Object.

: : : Example:Convert "March 16,2003" to CTime Object.

: : : with regards
: : : Nitin




Follow Ups:


Post a Follow Up:

Name:
E-Mail:

Subject:

Comments:


[ Follow Ups ] [ Post Follow Up ] [ C++ Topics and Explanations ]