Skip to content

Instantly share code, notes, and snippets.

@adamoudad
Created August 4, 2020 10:04
Show Gist options
  • Save adamoudad/60951f92e07b82065341579f17b61185 to your computer and use it in GitHub Desktop.
Save adamoudad/60951f92e07b82065341579f17b61185 to your computer and use it in GitHub Desktop.
Several syntax for formatting dates in python
from datetime import datetime
(datetime.today().strftime("%Y年%m月%d日"))
"{:%Y年%m月%d日}".format(datetime.today())
"{0:%Y}{1}{0:%m}{2}{0:%d}{3}".format(datetime.today(), "年", "月", "日")
f"{datetime.today():%Y年%m月%d日}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment