SQLite Forum

Bug ? Same query that works in shell produces constraint violation when run by a C program with sqlite3_{prepare,bind,step}
Although this has no effect on your problem, why are you adjusting a localized timestring using the 'utc' modifier?  (unless, of course, the bug is in the bit of code that determines the localtime offset)

Localized timestrings are already expressed in utc so the application of the 'utc' modifier will result in an incorrect time.