EJSuh EJSuh - 1 year ago 102
Python Question

Need help on datetime manipulation in python

import datetime
today = datetime.date.today()
print ('Today is: ' + str(today))

//returns Today is: 2016-10-06

How could I manipulate the output to look like this:
"Today is: October 6, 2016"

Answer Source

Based on datetime.strftime() documentation:

import datetime
today = datetime.date.today()
print('Today is: ' + today.strftime("%B %d, %Y")) # Today is: October 06, 2016


  • %B - Month as locale‚Äôs full name
  • %d - Day of the month
  • %Y - Year with century as a decimal number
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download