Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (16.4k points)

I can see a lot of changing over a date string to a DateTime object in Python, however I need to go the alternate way. 

I have 

datetime.datetime(2012, 2, 23, 0, 0)

also, I might want to change it over to string like '2/23/2012'.

1 Answer

0 votes
by (26.4k points)

Try using strftime, which will help you to format your date

For example:

import datetime

t = datetime.datetime(2012, 2, 23, 0, 0)




Click on this link for more information.

Interested to learn python in detail? Come and Join the python course.

Browse Categories