I’m a beginner in C.
- Is there any datatype for dates?
- In C we have for working with time, is there one for dates too?
- How can I calculate difference between two dates?
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.
No, inbuilt datatype in
C, you have to defined user-defined data type.You may try this:
In main() you need to declare three variables for type
data.In following example
todaydifference,for example you wants to take difference between current date (
c_date) and date of birth (dob)In
todayyou have difference between two dates.There is one more way:
double difftime (time_t end, time_t beginning);Read this answers:
1. How to compare two time stamp in format “Month Date hh:mm:ss”
2. How do you find the difference between two dates in hours, in C?