Click to See Complete Forum and Search --> : please help


pr_101
September 7th, 1999, 04:21 PM
Does anyone know why this doesn't work?

{
CTime theTime;
theTime=CTime::GetCurrentTime();
m_time=theTime;
}
m_time is a variable from an edit box in my dialog. I am having trouble getting it to set theTime equal to m_time. Please help, the error message is listed below. (I have tried making m_time a CString or an int, but nothing seems to work.)

error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class CTime' (or there is no acceptable conversion)

Thanks for everything.

Wayne Fuller
September 7th, 1999, 04:36 PM
You need to use the CTime::Format() function to get a string.

chiuyan
September 7th, 1999, 04:37 PM
It doesn't work because nobody has define an = operator that takes a CTime & puts it into a CString (or anything else).

if m_time is a CString, then use CTime::Format, if m_time is an int, then you can use CTime::GetTime, or CTime::GetYear, CTime::GetDay, etc.

HTH
--michael