from datetime import datetime


def getStartEndDates(startt,endt,tformat):
    """
    Create a list of strings with the first day and last day of a month between two dates
    """
    # convert to datetime objects
    t1 = datetime.strptime(startt,tformat)
    t2 = datetime.strptime(endt,tformat)
        
    tnow = t1
    tnow2 = tnow
    starttime=[]
    endtime=[]
    while tnow < t2:
        mo = tnow.month
        yr = tnow.year
        if mo == 12:
            tnow2=tnow2.replace(month=1)
            tnow2=tnow2.replace(year=yr+1)
        else:
            tnow2=tnow2.replace(month=mo+1)
        # Get the last day of the month here
        t3=datetime.fromordinal(tnow2.toordinal()-1) 
        starttime.append(tnow.strftime('%Y%m%d'))
        endtime.append(t3.strftime('%Y%m%d'))
        # Update tnow    
        tnow = tnow2
    
    return starttime, endtime