title: How To Fix DateTime type only accepts Python datetime and date objects as input in python?
body: <p>I'm creating a blog in Flask but I'm getting an issue while creating blog posts. I always get this error:</p>
  
  <pre><code>SQLite DateTime type only accepts Python datetime and date objects as input.
  </code></pre>
  
  <p>It's showing the error as coming from my models.py file.</p>
  
  <p>Here is my models.py file: </p>
  
  <pre><code>class Post(db.Model):
      __tablename__ = 'posts'
      id = db.Column(db.Integer,primary_key = True)
      title = db.Column(db.String(50),)
      time = db.Column(db.DateTime,nullable=False,default=str(datetime.datetime.now().strftime("%a, %b %d, %Y")))
      description = db.Column(db.Text,)
      user_id = db.Column(db.Integer,db.ForeignKey('users.id'))
  
      def __init__(self,title,description,user_id):
          self.title = title
          self.description = description
          self.user_id = user_id
  </code></pre>