Query to compare between date with time and date without time - python using access db

后端 未结 1 601
野的像风
野的像风 2021-01-28 03:23

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 co

相关标签:
1条回答
  • 2021-01-28 04:13

    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),))
    
    0 讨论(0)
提交回复
热议问题