Solved

Accessing the year

Posted on 1998-09-01
6
190 Views
Last Modified: 2013-11-19
How do I access the current year using MFC?  What is the  specific syntax?
0
Comment
Question by:Mark Ebden
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 2

Accepted Solution

by:
warmcat earned 50 total points
ID: 1321564
CTime time=CTime::GetCurrentTime();
int nYear=time.GetYear();


0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1321565

or

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

0
 

Author Comment

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

Mark
0
Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

 
LVL 2

Expert Comment

by:warmcat
ID: 1321567
Mark,

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

Regards,

-Andy
0
 

Author Comment

by:Mark Ebden
ID: 1321568
Andy,

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

I can't remember excatly.
0
 
LVL 2

Expert Comment

by:warmcat
ID: 1321569
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
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question