title: finding the start date end day in python
body: <pre><code>S = dt.datetime(2022, 3, 2).date()
  E = dt.date(2023, 7, 31)
  startyear = S.year
  startmonth = S.month
  while (startyear, startmonth) &lt;= (E.year, E.month):
      print(dt.date(startyear, startmonth, 1))
      if startmonth == 12:
          startyear = startyear + 1
          startmonth = 1
      else:
          startmonth = startmonth + 1
  </code></pre>
  <p>here I get the start date month year but I want end day of the month</p>
  <p>this is how I got the answer</p>
  <pre><code>2022-03-01
  2022-04-01
  2022-05-01
  2022-06-01
  2022-07-01
  2022-08-01
  2022-09-01
  2022-10-01
  2022-11-01
  2022-12-01
  2023-01-01
  2023-02-01
  2023-03-01
  2023-04-01
  2023-05-01
  2023-06-01
  2023-07-01
  </code></pre>
  <p>if anyone knows please answer me</p>
  <p>I want the output end of the day in a month</p>
  <pre><code>Sample Input: 02/12/2022, 24/02/2023 (Check and validate the start , end dates)
  Sample Output:
  [
              {'year': 2022, 'month': 'Dec', 'start_date': &quot;01/12/2022&quot;, 'end_date': &quot;31/12/2022&quot;, 'days': 31},
              {'year': 2023, 'month': 'Jan', 'start_date': &quot;01/01/2022&quot;, 'end_date': &quot;31/01/2023&quot;, 'days': 31},
              {'year': 2023, 'month': 'Feb', 'start_date': &quot;01/02/2022&quot;, 'end_date': &quot;28/02/2023&quot;, 'days': 28}  
  ]
  </code></pre>