You mean iso-8601 strings in the database?  Yes, you can format the strings 
however you want (ie with an unlimited seconds precision).  However, the 
internal datetime function only returns seconds (it is merely an alias for 
strftime using a format specifier that only outputs seconds), and if you use 
strftime then you can get milliseconds by using %f rather than %S in the format 
string.  The string, however, can be as long as you want without bothering 
SQLite in the least -- however the output of the internal functions will be 
truncated to the precision specified in the output format specifier and will be 
unlocalized (without an offset from GMT), so you have to magically remember the 
appropriate offset (or store and assume all naive strings are GMT).

sqlite> select datetime('2015-02-14 13:46:15.3948573647856354765 +04:00');
2015-02-14 09:46:15

sqlite> select strftime('%Y-%m-%d %H:%M:%S', '2015-02-14 
13:46:15.3948573647856354765 +04:00');
2015-02-14 09:46:15

sqlite> select strftime('%Y-%m-%d %H:%M:%f', '2015-02-14 
13:46:15.3948573647856354765 +04:00');
2015-02-14 09:46:15.394

---
Theory is when you know everything but nothing works.  Practice is when 
everything works but no one knows why.  Sometimes theory and practice are 
combined:  nothing works and no one knows why.


>-----Original Message-----
>From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
>boun...@sqlite.org] On Behalf Of Lance Shipman
>Sent: Thursday, 8 January, 2015 11:22
>To: sqlite-users@sqlite.org
>Subject: [sqlite] Support for millisecond
>
>Can SQLite support millisecond precision in date time data? I looking at
>doc I think so, but it's not clear.
>
>Regards,
>
>Lance Shipman
>Product Engineer
>Esri
>Redlands, CA USA
>_______________________________________________
>sqlite-users mailing list
>sqlite-users@sqlite.org
>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



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

Reply via email to