
Posted by Pete on December 12, 203 at 02:51:26:
In Reply to: Re: Handling Date Functions posted by Caio Proiete on April 03, 203 at 15:33:09:
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