user2675121
user2675121

Reputation: 191

"incorrect parameters" when I want to format CTime in MFC

I've got a DataTimePicker in mfc. Now, I want to format the value to a String. I format the value with

CTime m_BDate;

m_DataTimePicker.GetTime (m_BDate);
m_Bithdate= m_BDate.Format ("%d-%m-%Y");

But theres a problem. And a pretty strange problem. Whenever the value is < 1970, it doesnt work. So, 01.01.1970 works. 12.31.1969 doesnt. There comes the message "incorrect parameters". I really have no idea why.

Does anyone have any solution?

Upvotes: 0

Views: 392

Answers (1)

xMRi
xMRi

Reputation: 15375

That is exactly what the specs are saing (see MSDN). The lower range is 1.1.1970.

May be it is better to use COleDateTime or SYSTEMTIME to overcome such limitations. Again read the docs about GetTime.

Upvotes: 2

Related Questions