Adding days or weeks to a particular date in Python
I am working on a database project with python for the first time. To generate a report, i need to fetch records wherein the expiry date field has the values ranging from today to next fifteen days or say two weeks.
Anticipating assistance for the correct method to add days or weeks to a specific date selected by the user from the python code.
def fetch_report_date(start_date, conn): try: qry = "select * from Laptop_coverage where expiry_date='" & start_date & "'" cur = conn.cursor() cur.execute(qry) rcds = cur.fetchall() except mysql.connector.Error as e: finally: if conn.is_connected(): conn.close() cur.close()
i need to convert the where clause in query to cater a between condition where start_date will be the one provided and the end_date would be start_date + 15, which i want to calculate.