# Python time conversions x = datetime.datetime.now() x.strftime('%Y-%m-%d %H:%M:%S') '2021-11-30 08:11:51' String to datetime: datetime.strptime z=datetime.strptime(y, '%Y-%m-%d %H:%M:%S') #python 3.8 + dammit datetime.datetime(*(time.strptime(y, '%Y-%m-%d %H:%M:%S')[0:6]))#painful