I have times from a table that take this form:
2017-12-31T23:59:59.8560818Z
I'm not entirely sure what form this actually is. All I know is that I want to convert it in python to a type of time that is acceptable to insert into a postgres table as a timestamp or date (I really only care about the date). Any ideas for a better way to do this than just taking a substring of the date?
When I try this:
exchange_rate['time'] = str(exchange_rate['time'])[:10] #captures the YYY-MM-DD from date
exchange_rate['time'] = datetime.datetime.strptime(exchange_rate['time'], '%Y-%m-%d') #converts to datetime
cursor.execute('''INSERT INTO bitcoin VALUES ({},{})'''.format(exchange_rate['time'],exchange_rate['rate']))
I get this error:
