We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Accessing the year

Mark Ebden
Mark Ebden asked
on
Medium Priority
226 Views
Last Modified: 2013-11-19
How do I access the current year using MFC?  What is the  specific syntax?
Comment
Watch Question

Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

or

int nYear = COleDateTime::GetCurrentTime().GetYear() ;

Author

Commented:
I like Answers2000's answer better, since the proposed answer failed to work in Windows 95 -- although it worked on Windows NT.  Thanks,

Mark

Commented:
Mark,

Thanks for accepting the answer, but I have used the above code in '95 without problems.  What behaviour did you experience?

Regards,

-Andy

Author

Commented:
Andy,

I think it was "this program has performed an illegal operation... etc."

I can't remember excatly.

Commented:
Mark,

Very odd.  I should think it was some other code caused the exception, because I have used the above code in shipping products without any trouble.  I should also think that the COleDateTime probably calls down to the same code.

Regards,

-Andy
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.