What do you want to save?
Add Code snippet
New code examples
-
SQL 2022-01-29 12:00:14
mysql connector/python query example
Press CTRL+C to copy import datetime import mysql.connector cnx = mysql.connector.connect(user='scott', database='employees') cursor = cnx.cursor() query = ("SELECT first_name, last_name, hire_date FROM employees " "WHERE hire_da... Add solution -
Python 2022-01-27 23:37:04
return the timestamp after some days in python
from datetime import date, timedelta current_date = date.today().isoformat() days_before = (date.today()-timedelta(days=30)).isoformat() days_after = (date.today()+timedelta(days=30)).isoformat() print("\nCurrent Date: ",current_date) pri... Add solution -
Python 2022-01-27 22:05:02
add 3 years to a given date in python code
import datetime from datetime import date def addYears(d, years): try: #Return same day of the current year return d.replace(year = d.year + years) except ValueError: #If not same day, it will return other, i.e. February 29 to Mar... Add solution -
Python 2022-01-27 06:32:43
how to compare current date to future date pythono
import datetime CurrentDate = datetime.datetime.now() print(CurrentDate) ExpectedDate = "9/8/2015 4:00" ExpectedDate = datetime.datetime.strptime(ExpectedDate, "%d/%m/%Y %H:%M") print(ExpectedDate) if CurrentDate > ExpectedDate: ... Add solution -
Python 2022-01-24 00:11:32
dateentry python german format
import tkinter as tk from tkcalendar import DateEntry window = tk.Tk() DateEntry(window, date_pattern='mm/dd/yyyy').pack() # custom formatting, mm/dd/yyyy DateEntry(window, locale='en_US').pack() # default formatting window.mainloop() Add solution -
Python 2022-01-23 19:11:06
how to extract month from date in python
import datetime date = '2021-05-21 11:22:03' datem = datetime.datetime.strptime(date, "%Y-%m-%d %H:%M:%S") print(datem.day) # 25 print(datem.month) # 5 print(datem.year) # 2021 print(datem.hour) # 11 print(datem.minute) ... Add solution