Reputation: 64054
I have the following date
from datetime import datetime
test = datetime(2015,9,8)
Which looks like this:
In [18]: type(test)
Out[18]: datetime.datetime
In [19]: print test
2015-09-08 00:00:00
What I want to do is to convert
2015-09-08
into
Sept8
Basically pick the first four letter of each month and append it to the date. How can I achieve that?
Upvotes: 2
Views: 206
Reputation: 117771
This should work and uses the localization of the system:
test.strftime("%B")[:4] + str(test.day)
Upvotes: 2