I want to compare two dates “2010-08-12” and “2010-8-12” but using strcmp it is failing so please suggest any inbuilt C function or any C function to compare these dates.
Regards
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can write a simple and straightforward function to convert a date to a number that is good enough for ordering purposes by using
strtol:Call the above function on both dates, and compare the
intresults; the returned value will be smaller for the earlier date.