Get Month Name Full Version - Python datetime
Python datetime - Get Month Name Full Version
To get Month Name Full Version using Python datetime, call strftime()
with %B
passed as argument.
Examples
1. Get month name full version from current date
In the following example, we will take the current date, and get the day of month.
Python Program
#import datetime package
import datetime
#get current time
d = datetime.datetime.now()
#print date
print(d)
#get month name full version
print(d.strftime("%B"))
Output
2019-06-26 08:51:18.164152
June
2. Get month name full version from given date
In the following example, we will take a date 2019-08-12 and get the day of month.
Python Program
#import datetime package
import datetime
#set specific date
d = datetime.datetime(2019, 8, 12)
#print date
print(d)
#get month name full version
print(d.strftime("%B"))
Output
2019-08-12 00:00:00
August
Summary
In this tutorial, we extracted the month name full version from date using datetime package.