+ 2

Print the date in different format

Input a date and print it in the following format for example - Input-12 5 2014 Output - 12th,May,2014 Bonus : check if the other user entered a valid date beforehand For example : 12 5 2015(valid) 30 2 2013(invalid) 28 2 2017(valid) 29 2 2012(valid) 29 2 2013(invalid) 21 35 2015(invalid) 0 2 2014(invalid)

10th Oct 2017, 5:37 AM
Chinmoy
Chinmoy - avatar
3 Answers
+ 3
Hmm, I see this needs some work with ifs and elses
10th Oct 2017, 7:21 AM
👑 Prometheus 🇾🇬
👑 Prometheus 🇾🇬 - avatar
+ 3
Here you go. Checks for valid date input. Accounts for leap years. https://code.sololearn.com/cGhUEwvBgHL7/?ref=app
13th Oct 2017, 10:47 AM
Vari93
Vari93 - avatar
+ 1
Hint: use arrays (one use would be storing max number of days in each month in array )
10th Oct 2017, 7:39 AM
Chinmoy
Chinmoy - avatar