Skip to content

Instantly share code, notes, and snippets.

@garraflavatra
Created July 10, 2021 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garraflavatra/ecda3975a277113188779fa4be7dd9a6 to your computer and use it in GitHub Desktop.
Save garraflavatra/ecda3975a277113188779fa4be7dd9a6 to your computer and use it in GitHub Desktop.
Get a formatted date in Python. See https://www.w3schools.com/python/gloss_python_date_format_codes.asp for an overview of all formatting codes.
import datetime
x = datetime.datetime.now()
print(x.strftime("%Y-%m-%d %H:%M:%S"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment