Skip to content

Instantly share code, notes, and snippets.

@SymonRod
Last active October 25, 2021 08:45
Show Gist options
  • Save SymonRod/6ae16851e7bd7236ca1fda74554b50f7 to your computer and use it in GitHub Desktop.
Save SymonRod/6ae16851e7bd7236ca1fda74554b50f7 to your computer and use it in GitHub Desktop.
Python Stuff
from datetime import datetime
now = datetime.now() # current date and time
year = now.strftime("%Y")
print("year:", year)
month = now.strftime("%m")
print("month:", month)
day = now.strftime("%d")
print("day:", day)
time = now.strftime("%H:%M:%S")
print("time:", time)
date_time = now.strftime("%m/%d/%Y, %H:%M:%S")
print("date and time:",date_time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment