Hi everyone,
      I have an issue with datetimes that doesn't return the "time" part 
correctly (always 00:00:00 or 18:00:00) when I use SQLite in my C++ 
code. Whenever I use datetime('now'), or current_timestamp, the time is 
not correct. However, it works correctly when using the sqlite3 program 
(sqlite-3_5_9.zip from download page). Right now I use the SQLite dll 
(sqlitedll-3_5_9.zip) in my code, but I also tried with the source code 
amalgamation with the same results <sqlitedll-3_5_9.zip>

*SQLite3:*
sqlite> SELECT DATETIME('NOW');
2008-07-14 17:41:56
sqlite>


*From my program:*
static int callbackExec(void *NotUsed, int argc, char **argv, char 
**azColName)
{
    for(int i = 0; i < argc; i++)
    {
        std::stringstream ss;
        ss << azColName[i] << " = " << argv[i] ? argv[i] : "NULL";
        LogEngine::LogError(ss.str().c_str());
    }

    return 0;
}

void testDatetime()
{
    std::string selectDateTime = "SELECT DATETIME('NOW')";
    if( sqlite3_exec(mSQLiteDatabase, selectDateTime.c_str(), 
callbackExec, 0, &errMsg) != SQLITE_OK )
    {
        ...
    }
}

Result:
DATETIME('NOW') = 2008-07-14 18:00:00


I really have no clue why it would do that.

- Sebastien R.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to