I see a lot on converting a datetime
string to an datetime
object in Python, but I want to go the other way.
I've got datetime.datetime(2012, 2, 23, 0, 0)
and I would like to convert it to string like '2/23/2012'
.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
You can use strftime to help you format your date.
E.g.,
will yield:
More information about formatting see here
You can convert datetime to string.
published_at="{}".format(self.published_at)