-2

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.

Subhrajyoti Das
  • 2,685
  • 3
  • 21
  • 36
sowmya
  • 221
  • 1
  • 3
  • 15

1 Answers1

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