this is my code request Notification.create_time
result = session.query( Notification.content, cls.is_read, Notification.create_time).join( cls, Notification.id == cls.notification).filter( and_(cls.user == user_id)).order_by( Notification.create_time.desc()).all()
elsewhere, you need to execute json.dumps the query result for frontend, the datetime format can't json.dumps, so I want to do like this:
session.query(Notification.create_time.strftime('%Y-%m-%d %H:%M'))
So how to change date and time to string in sqlalchemy query?
source share