Im trying to convert a specific date to unix, but unfortunatelly something seems to be missing/wrong. Any help, will be highly appreciated.
releasedate='Jul 07 2022 02:00:00'
releasedate2 = datetime.strptime(releasedate, '%b-%d-%Y-%H:%M:%S')
unixdate = (releasedate2 - datetime(1970, 1, 1)).total_seconds()
CodePudding user response:
You had used the wrong date and time format.
You used: %b-%d-%Y-%H:%M:%S
when the format of the date you have is %b %d %Y %H:%M:%S
.
CodePudding user response:
The date format you are using does not match the format of the date.
You are using -
but the date has a space.
change it to '%b %d %Y %H:%M:%S'