start date end date in python validation

Viewed 29

1)get date as a string from user 2)convert to date object 3)find the first and last date of the month 4)append the list in the given format 5)find the next month of the date 6)repeat the step 3 and 5 until the date is lesser then the end date Sample Input:

02/12/2022, 24/02/2023 (Check and validate the start , end dates)

Sample Output:

[
            {'year': 2022, 'month': 'Dec', 'start_date': "01/12/2022", 'end_date': "31/12/2022", 'days': 31},
            {'year': 2023, 'month': 'Jan', 'start_date': "01/01/2022", 'end_date': "31/01/2023", 'days': 31},
            {'year': 2023, 'month': 'Feb', 'start_date': "01/02/2022", 'end_date': "28/02/2023", 'days': 28}  
]
0 Answers
Related