On 6/25/15, Alessandro Tagliati <a.tagliati at selea.com> wrote:
> Hi Marco,
> it's true that sqlite seems to manage only epoch time up to seconds
> precision: I have my timestamps with microseconds resolution and this is
> what I have to do in order to have them in a human readable form:
>      SELECT COALESCE(datetime(TimeStamp/1000000, 'unixepoch',
> 'localtime'),'')||'.'||COALESCE((TimeStamp/1000)%1000,'')....

Or:

SELECT printf('%s.%03d',
datetime(TimeStamp/1000,'unixepoch'),TimeStamp%1000) ...

>
> Alessandro
>
> Il 25/06/2015 08.18, Marco Bambini ha scritto:
>> Hello I tried to convert an epoch time with a timestamp in milliseconds
>> like 1393732179010 to a correct date but it seems like that the function:
>> SELECT datetime(1393732179010, 'unixepoch', 'localtime');
>> is not able to detect ms resolution and incorrectly reports a negative
>> date.
>>
>> How can I tell sqlite to interpret timestamp in ms?
>> Thanks.
>> --
>> Marco Bambini
>> http://www.sqlabs.com
>> http://twitter.com/sqlabs
>> http://instagram.com/sqlabs
>>
>>
>>
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>
> --
> ------------------------------------------------------------------------
>
> *Ing. Alessandro Tagliati*
> /R/D - Software Projects Manager
> / a.tagliati at selea.com <mailto:a.tagliati at selea.com>
>
> ------------------------------------------------------------------------
> Selea s.r.l <http://www.selea.com>
>
> V. Aldo Moro, 69
> 46015 Viadana MN - Italy
> <https://www.google.it/maps/place/44%C2%B056%2725.9%22N+10%C2%B028%2757.4%22E/@44.940528,10.482618,194m/data=%213m2%211e3%214b1%214m2%213m1%211s0x0:0x0>
>
> Phone: +390375889091 <tel:+390375889091>
> Fax: +390375889080
> http://www.selea.com
>
>       
>
> Questo messaggio e' da ritenersi confidenziale e indirizzato solamente
> ai destinatari esplicitamente indicati. Qualora la mail venisse ricevuta
> per errore da altri si prega di cancellarla immediatamente e informare
> il mittente.
>
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they are
> addressed. If you have received this email by error please delete it and
> notify the sender.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
D. Richard Hipp
drh at sqlite.org

Reply via email to