How to get Weekday Full Version using Python datetime?

Python datetime – Get Weekday Full Version

To get Weekday Full Version using Python datetime, call strftime() with %A passed as argument.

Examples

1. Get weekday full version of current date

In the following example, we will take the current date, and get the full version of the weekday.

Python Program

# Import datetime package
import datetime

# Get current time
d = datetime.datetime.now()

# Print date
print(d)

# Get the weekday full version
print(d.strftime("%A"))
Run Code Copy

Output

2019-06-26 08:09:03.092652
Wednesday

2. Get weekday full version from a given date

In the following example, we will take a date 2019-08-12 and get the full version of the weekday.

Python Program

# Import datetime package
import datetime

# Set a date
d = datetime.datetime(2019, 8, 12)

# Print date
print(d)

# Get the weekday full version
print(d.strftime("%A"))
Run Code Copy

Output

2019-08-12 00:00:00
Monday

Summary

In this tutorial, we extracted the full version of weekday from date using datatime package.

Related Tutorials

Code copied to clipboard successfully 👍