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
8 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
100 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,120 points
976 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,500 points
100 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,500 points
28 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
20 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,710 points
20 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.