How can I turn an input date into a readable string in Python?

0 votes
input : 2010-01-28 08:39:49.000003

output i want: 
"January 28, 2010"
How do I do this?
Dec 11, 2018 in Python by charlie_brown
• 7,740 points
51 views

1 answer to this question.

0 votes

The datetime class has a method strftime. strftime() Behavior in the Python docs documents the different formats it accepts.

For this specific example, it would look something like:

my_datetime.strftime("%B %d, %Y")
answered Dec 11, 2018 by Aryya
• 7,350 points

Related Questions In Python

0 votes
1 answer

How can I convert a list of dictionaries from a CSV into a JSON object in Python?

You could try using the AST module. ...READ MORE

answered Apr 17, 2018 in Python by anonymous
1,041 views
0 votes
1 answer

How can I write code to find a palindrome in python without using string functions?

In Logic 1, try if i<int(length/2): instead of if i<int((length/2+1)): In ...READ MORE

answered Jan 16, 2019 in Python by charlie_brown
• 7,740 points
4,728 views
0 votes
1 answer

How do I check if input string is a valid regular expression or not in Python?

Hi. Good question! Well, just like what ...READ MORE

answered Feb 12, 2019 in Python by Nymeria
• 3,520 points
403 views
+3 votes
7 answers

How can I rename a file in Python?

yes, you can use "os.rename" for that. ...READ MORE

answered Mar 31, 2018 in Python by DareDev
• 6,850 points
316 views
0 votes
1 answer
+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, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 556 views
0 votes
0 answers
+4 votes
6 answers
0 votes
1 answer

How can I define a multidimensional array in python using ctype?

Here's one quick-and-dirty method: >>> A = ((ctypes.c_float ...READ MORE

answered Oct 9, 2018 in Python by Aryya
• 7,350 points
575 views
0 votes
1 answer

How can I print an Error in Python?

For Python 2.6 and later and Python ...READ MORE

answered Oct 12, 2018 in Python by Aryya
• 7,350 points
77 views