You have to look at the original dates. The date you're giving it for the first one is Feb 29th on a leap year. So 31 years from Feb 29th goes to Feb 29th on a NON-leap year, and thus gets rolled over to March 1st. For the second one you're saying 31 years from March 1st, which also lands on March 1st.
-----Original Message----- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Fábio Pfeifer Sent: Thursday, October 18, 2018 9:28 AM To: sqlite-users@mailinglists.sqlite.org Subject: [sqlite] Bug report: bug in datetime conversion function Hello, When working with Apple iOS databases, I found something strange when dealing with dates. Apple iOS databases store dates as seconds from 2001-01-01 (31 years after unix epoch). But from 2015-03-02 to 2016-02-29 there is a offset of one day if '31 years' modifier is used. To reproduce, execute the following query: select datetime(446860801, 'unixepoch', '31 years') as date1, datetime(446860801+60*60*24, 'unixepoch', '31 years') as date2, datetime(446860801+60*60*24*2, 'unixepoch', '31 years') as date3 date2 should be 1 day after date1, but shows as the same date! Best regards, Fábio Pfeifer _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users