Solved

Accessing the year

Posted on 1998-09-01
6
178 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
  • 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Process filename extension 3 156
viewing source code from eclipse 13 74
wait notify demo infinite loop 3 80
zeroMAx challenge 20 76
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now