Skip to content

Instantly share code, notes, and snippets.

@romicofre
Created April 13, 2020 19:32
Show Gist options
  • Save romicofre/5be6dc1d0f4e3736a2ad517d05c27eca to your computer and use it in GitHub Desktop.
Save romicofre/5be6dc1d0f4e3736a2ad517d05c27eca to your computer and use it in GitHub Desktop.
Convert date string format
fecha = "20200413191418"
objeto_fecha = datetime.strptime(fecha, '%Y%m%d%H%M%S').strftime('%Y-%m-%dT%H:%M:%S')
print(objeto_fecha)
print(type(objeto_fecha))
#result:
# 2020-04-13T19:14:18
# <class 'str'>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment