How send Datetime as parameter in SQL command on Python?
<p>I have a sql command and just want to select some records with some conditions ( using python &amp; db is Postres): 
So, my query is:</p>

<pre><code> current_date= datetime.now()

  tt = yield self.db.execute(self.db.execute('SELECT "Id", "RubricId", "IsRubric"  
     FROM whis2011."CoockieUserInterests"
     'WHERE "UserId" = %s AND "Date" = %s '
     % (Id, current_date))

result=tt.fetchall()[0]
</code></pre>

<p>Problem: when I want to pass datetime to field "Date" I got error: </p>

<pre><code>syntax error at or near "00"
LINE 1: ...rests" WHERE "UserId" = 1 AND "Date" = 2016-10-05 00:22:07.3...
                                                         ^
</code></pre>

<p>All "Date" fields in db is like: 2016-09-25 00:00:00</p>

<p>Also, datatype of field "Date" in database is "timestamp without time zone".</p>

<p>it's my pool: </p>

<pre><code>    application.db = momoko.Pool(
    dsn='dbname=xxxx user=xxxxx password=xxxxx host=xxxx port=5432',
    size=1,
    ioloop=ioloop,
)
</code></pre>

<p>How I can select "Date" with format like this in my db? </p>