Compare input date with current date!
-
Hi' I'm new to C++? This code to show current date. #include #include "string.h" #include "time.h" #include int main() { tdclass TimeDateClass; cout<<"Today is "<<TimeDateClass.date()<<endl; system("pause"); } How to compare date we input and compare is it less or more from the current date? Tq
-
Hi' I'm new to C++? This code to show current date. #include #include "string.h" #include "time.h" #include int main() { tdclass TimeDateClass; cout<<"Today is "<<TimeDateClass.date()<<endl; system("pause"); } How to compare date we input and compare is it less or more from the current date? Tq
One idea is to convert the dates to corresponding number of days and compare.
- NS - [ODBaseBtn]
-
Hi' I'm new to C++? This code to show current date. #include #include "string.h" #include "time.h" #include int main() { tdclass TimeDateClass; cout<<"Today is "<<TimeDateClass.date()<<endl; system("pause"); } How to compare date we input and compare is it less or more from the current date? Tq
You can use COleDateTime[^] class. It have comparison operators such as ==, <, <=, etc[^] which can be used for comparison. Regards, Jijo.
_____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.
-
One idea is to convert the dates to corresponding number of days and compare.
- NS - [ODBaseBtn]
-
For example, days1 = day1 + month1*31 + year1*365; days2 = day2 + month2*31 + year2*365; if( days1 > days2 ) { do something } else { do something }
- NS - [ODBaseBtn]