Home > Enterprise >  Changing Date format with default property
Changing Date format with default property

Time:08-05

I am wondering how can I change the default time output in flask

mysql property is as below

created_at = db.Column(db.DateTime, nullable=False, default=datetime.now)

for this I get output on html as - 2022-08-05 13:27:09.208330 how can I change this into 2022-08-05 13:27 I tried adding strftime but it doesn't support

CodePudding user response:

I think you can encapsulate a function, return the time in this format, and then replace it datetime.now
Because he is calling this function for you

  • Related