I've been trying to store dates as strings in sqlite but I'm having trouble getting the right results when querying. The problem I am having seems to come down to the fact that I'm getting different results using strftime in sqlite and python. I'm converting the same date to seconds in each and getting different results.
In [1]: import sqlite3
In [2]: from datetime import datetime as dt
In [3]: conn = sqlite3.connect(':memory:')
In [4]: cur = conn.cursor()
In [5]: cur.execute("select strftime('%s','2012-05-01 12:03:33')").fetchone()
Out[5]: (u'1335873813',)
In [6]: dt.strptime('2012-05-01 12:03:33', '%Y-%m-%d %H:%M:%S').strftime('%s')
Out[6]: '1335830613'
I was expecting that both would give me the same result. Am I missing something?
Thanks! -Jared Kibele