I’m using flask-sqlalchemy with postgresql database.
I have some Columns with timestamps. I'm setting them like this:
class Return_attempt(db.Model):
''' Data related with each return attempt'''
time_waiting_collection = \
db.Column(db.DateTime(), server_default=db.func.localtimestamp())
time_collected = db.Column(db.DateTime())
Example of timestamp stored in db (server_default): 2020-02-19 19:41:36.975644
Now, I want to use this timestamp in the frontend but I'm only interested in the time with precision to the seconds. In the example above, I want to display it like this: 2020-02-19 19:41:36.
So my question is, how can I store the timestamp with that precision? Or is there any way to easily manipulate the format of the displayed timestamp? (I'm using python and jinja2 for templating)
Thank you!