I have the following code that extracts a postgres CURRENT_TIMESTAMP from a database
cursor.execute("SELECT submitdate FROM journeys WHERE display = true")
submitDate = cursor.fetchone()['submitdate']
which returns
2015-08-11 12:44:31.790462
How would I format this to show as 11-08-2015 for example?
I've read about and tried things such as this but they don't work
print(
datetime.datetime.fromtimestamp(
int("1284101485")
).strftime('%Y-%m-%d %H:%M:%S')
)
11-08-2015then it shoud be submitDate.strftime("%d-%m-%Y")