Answers for "how to print day and month name in python"

3

python get day name

import datetime
now = datetime.datetime.now()
print(now.strftime("%A"))
Posted by: Guest on June-07-2020
3

python get current month

Use:

from datetime import datetime
today = datetime.today()
datem = datetime(today.year, today.month, 1)
I assume you want the first of the month.
Posted by: Guest on March-08-2021

Code answers related to "how to print day and month name in python"

Python Answers by Framework

Browse Popular Code Answers by Language