How can i convert date from this formt "Tue May 15 2018 00:00:00 GMT-0400 (EDT)" to date in the format yyyy-mm-dd?
Asked
Active
Viewed 1,275 times
0
-
2Possible duplicate of [Converting string into datetime](https://stackoverflow.com/questions/466345/converting-string-into-datetime) – pault May 02 '18 at 19:27
2 Answers
0
You can try:
from datetime import datetime
date_converted = datetime.strptime(time_string, '%Y-%m-%d')
Chiefir
- 2,341
- 1
- 23
- 42
-
The question specifically asks for the given format. This does not work with the provided string. It would help if you adjusted the format for the one given in the question. – cisnjxqu May 02 '18 at 19:41