I want to convert Wed, 14 Mar 2018 07:30:00 GMT
to 2018/03/14 in python. I am getting unicode object has no attribute strftime
error. Someone help me.
Asked
Active
Viewed 57 times
-2

Subhrajyoti Das
- 2,685
- 3
- 21
- 36

sowmya
- 221
- 1
- 3
- 15
-
please try to do by yourself before posting it here. – Veera Balla Deva Mar 14 '18 at 09:24
-
Thanks for your suggestion @Pradam,but i have asked question after i tried.. – sowmya Mar 14 '18 at 09:27
-
if you have tried please share your code? – Veera Balla Deva Mar 14 '18 at 09:28
1 Answers
1
Use:
from datetime import datetime
date_given = 'Wed, 14 Mar 2018 07:30:00 GMT'
datetime.strptime(date_given, '%a, %d %b %Y %H:%M:%S %Z').strftime('%Y/%m/%d')
You can read up below links for more details:

Subhrajyoti Das
- 2,685
- 3
- 21
- 36