Date and times with Python: Revision history

Diff selection: Mark the radio buttons of the revisions to compare and hit enter or the button at the bottom.
Legend: (cur) = difference with latest revision, (prev) = difference with preceding revision, m = minor edit.

28 March 2023

  • curprev 09:3509:35, 28 March 2023Mr. MacKenty talk contribs 1,335 bytes +1,335 Created page with "<syntaxhighlight lang="python"> import datetime # to get the current date and time: print(datetime.datetime.now()) # to get the current date: print(datetime.date.today()) # to get the current time: print(datetime.datetime.now().time()) # to get the current year: print(datetime.datetime.now().year) # to get the day of the week: print(datetime.datetime.now().weekday()) # to print the day of the week: print(datetime.datetime.now().strftime("%A")) # to ask the user to..."