I think the usage page is still a bit confusing in some places, at
least to inexperienced users, like me:

"... 64-bit long of milliseconds since UTC. This is the standard unix
timestamp."

It does not say since _which date_ UTC (1970-01-01 00:00:00). Also the
"standard unix timestamp" is 32-bit long and it's seconds since this
date, so both are not exactly the same.

In the last line in the second example:
assert(rs.getDate(1).equals(new Date(987654321)));
there should be a millisecond value, e.g.:
assert(rs.getDate(1).equals(new Date(987654321000)));

BTW, it is also possible to store timestamps with milliseconds
precision in the standard SQLite date format, like in the following:

    prep = conn.prepareStatement(
        "insert into test values strftime('%Y-%m-%d %H:%M:%f', ?/
1000., 'unixepoch');");
    prep.setDate(1, new Date(1092941466123));
    prep.executeUpdate();

    rs = stat.executeQuery("select * from test;");
    assert(rs.getString(1).equals("2004-08-10 18:51:06.123"));

    rs = stat.executeQuery("select
(strftime('%J',col1)-2440587.5)*864e5+.5 from test;");
    assert(rs.getDate(1).equals(new Date(987654321)));


--~--~---------~--~----~------------~-------~--~----~
Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en
To unsubscribe, send email to [EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to