
Posted by Caio Proiete on April 03, 203 at 15:33:09:
In Reply to: Handling Date Functions posted by Nitin kumar on March 26, 203 at 04:39:16:
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