A valid month value must be from 1 to 12 (e.g. January is 1). The day value must be from 1 to a value that is appropriate for the given month. September, April, June, and November each have 30 days. February has 28 days except for leap years when it has 29. The remaining months all have 31 days each. A leap year is any year that is divisible by 4 but not divisible by 100, or it is divisible by 400. For the output, if the date is correct, display the date in the format // (e.g. 19/September/2017 if the input is 19 for day, 9 for month and 2017 for year). If the date is not valid, display a message explaining why it is not valid (whether the day or the month is not valid. e.g. If the input is 31 for day, 4 for month, 2017 for year, the message should be “ Wrong Date: Day is not valid) ).
Here is the complete program:
C program to validate date (Check date is valid or not)