Python datetime: How to change month number to month name?

0 votes

Hi. I am using python to get the current time and date using the datetime module. The date is being printed in number.

time=datetime.datetime.now()
print(time)
2019-05-09 13:02:27.989905

I want to convert it into the name of the months. How can I do?

May 9 in Python by Raj
289 views

1 answer to this question.

0 votes

You can use the datetime module to convert the month to month name.

Here’s the code to do it:

time=datetime.datetime.now()
print(time.strftime("%B"))
answered May 9 by Suman

Related Questions In Python

0 votes
2 answers

How to calculate square root of a number in python?

calculate square root in python >>> import math ...READ MORE

answered Apr 2 in Python by anonymous
184 views
0 votes
1 answer

How to convert datetime.date to UTC timestamp in Python

In Python 3 (< 3.3) From the docs ...READ MORE

answered Oct 31, 2018 in Python by Priyaj
• 56,520 points
1,907 views
0 votes
1 answer

How to parse date/time string with timezone abbreviated name in Python?

The parse() function in dateutil can't handle ...READ MORE

answered Nov 27, 2018 in Python by Nymeria
• 3,520 points
174 views
0 votes
1 answer

How to change one character in a string in Python?

Python strings are immutable, you change them ...READ MORE

answered Dec 4, 2018 in Python by Nymeria
• 3,520 points
61 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 224 views
+4 votes
6 answers
0 votes
1 answer

How to round a floating point number up to certain decimal place in Python?

This is normal (and has nothing to do ...READ MORE

answered Oct 8, 2018 in Python by charlie_brown
• 7,720 points
43 views