Discuss C++ Date Problem, days of month, months from days in the C/C++ Help forum on Dev Articles. C++ Date Problem, days of month, months from days C/C++ Help forum discussing building and maintaining applications in C/C++. Find out why these languages are the foundation on which other languages are built.
Posts: 1
Time spent in forums: 27 m 55 sec
Reputation Power: 0
C++ Date Problem, days of month, months from days
I have inherited some c++ code that uses MFC to calculate the months and days of that month from the day of year. i.e.
1 = 1 day, 1 month;
6 = 6 days, 1 month;
33 = 2 day, 2 month;
365 = 31 days, 12 month
The code previously used MFC classes to calculate the number of months and the days of that month from the total days since the start of the year.
I am looking for a c++ method that does not use MFC but can use win32 methods to calculate the number of days and number of months from the total number of days provided.
printf("Day %u for month %u in year %u\n", numdays, month, year);
/* return succes */
return0;
}
I had to add 'year' to the inputs, since you have to take leap years into account.
__________________ This is my code. Is it not nifty?
"The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools."
---Douglas Adams
Join the Itsacon fanclub!
Zero Tolerance: Spammers banned so far: 280
Last edited by Itsacon : February 10th, 2006 at 05:27 PM.
Open Source Security Myths Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual
property restrictions (or arrangement such as the public domain), and is
usually developed with the input of many contributors. Request Your Free Technology Downloads!
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper. Request Your Free Technology Downloads!