On Tue, Mar 19, 2013 at 12:51 PM, Philipp Kursawe <[email protected]>wrote:

> INSERT INTO test VALUES(CURRENT_TIMESTAMP)
>
> This goes through without an error and the physical db file then really
> contains the current timestamp as a string.


CURRENT_TIMESTAMP is of text type. Simon's strftime() is also of text type,
but easily convertible (explicitly via cast, or implicitly via type
affinity) to an integer. --DD

C:\Users\DDevienne>sqlite3
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
sqlite> select CURRENT_TIMESTAMP;
2013-03-20 12:12:19
sqlite> select typeof(CURRENT_TIMESTAMP);
text
sqlite> select strftime('%s','now');
1363781564
sqlite> select typeof(strftime('%s','now'));
text
sqlite> select cast(strftime('%s','now') as int);
1363781631
sqlite> select typeof(cast(strftime('%s','now') as int));
integer
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to