Programming Examples
Java program to accept date in dd mm yyyy format and check whether it is valid date or not
Design a program which accepts your date of birth in dd mm yyyy format. Check whether the date entered is valid or not. If it is valid, display “VALID DATEâ€, also compute and display the day number of the year for the date of birth. If it is invalid, display “INVALID DATE†and then terminate the program.
Test your program for the given sample data and some random data.
Example 1 :
INPUT: Enter your date of birth in dd mm yyyy format
05
01
2010
OUTPUT: VALID DATE 5
Example 2 :
INPUT: Enter your date of birth in dd mm yyyy format 03
04
2010
OUTPUT: VALID DATE
93
Example 3 :
INPUT: Enter your date of birth in dd mm yyyy format 34
06
2010
OUTPUT: INVALID DATE
Output