Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jupyter-naas
GitHub Repository: jupyter-naas/awesome-notebooks
Path: blob/master/Datetime/Datetime_Get_the_weekday_of_the_current_date.ipynb
2973 views
Kernel: Python 3

Datetime.png

Datetime - Get the weekday of the current date

Give Feedback | Bug report

Tags: #datetime #weekday #python #library #get #date

Last update: 2023-11-16 (Created: 2023-11-16)

Description: This notebook will get the weekday of the current date: Monday is 0 and Sunday is 6.

Input

Import libraries

import datetime

Setup variables

  • today: date to get the weekday from

today = datetime.date.today()

Model

Get weekday

weekday = today.weekday()

Output

Display result

print(f"The weekday of {today} is {today.strftime('%A')} ({weekday})")