Skip to content Skip to sidebar Skip to footer

Query To Compare Between Date With Time And Date Without Time - Python Using Access Db

I need help to create query to compare between date with time and date without time. I am using python with access db (pypyodbc). In the database I have a column that contains date

Solution 1:

Consider using MS Access' DateValue function that extracts only the date component (TimeValue being the time component counterpart).

Also, consider passing your date value as parameter to better integrate with your Python environment with no need to concatenate into Access' # form. Below passes a parameter as tuple of one item:

from datetime import datetime

...
cur.execute("SELECT * FROM MDSSDB WHERE DateValue([ValidStartTime]) = ?", (datetime(2016, 5, 17),))

Post a Comment for "Query To Compare Between Date With Time And Date Without Time - Python Using Access Db"