Re: [sqlite] Fwd: [sqlite-forum] Convert datetime string to second since Epoch with millisecond precision

2020-03-17 Thread Keith Medcalf

select (strftime('%J', '2016-06-13T09:36:34.123Z') - 2440587.5) * 86400.0;
1465810594.123

-- 
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.

>-Original Message-
>From: sqlite-users  On
>Behalf Of Dominique Devienne
>Sent: Tuesday, 17 March, 2020 10:37
>To: General Discussion of SQLite Database us...@mailinglists.sqlite.org>
>Subject: [sqlite] Fwd: [sqlite-forum] Convert datetime string to second
>since Epoch with millisecond precision
>
>Reposting to the ML, maybe I'll have more luck there, than in the forum?
>--DD
>
>-- Forwarded message -
>From: ddevienne 
>Date: Tue, Mar 17, 2020 at 5:09 PM
>Subject: [sqlite-forum] Convert datetime string to second since Epoch
>with
>millisecond precision
>To: 
>
>
>Forum post by ddevienne on 2020-03-17 16:09:17
>https://sqlite.org/forum/forumpost/0d9c338ff1
>
>Hi. Below does what I want, but surely there's a better way than parsing
>the datetime 3 times? Because the below is ugly as hell. Thanks, --DD
>
>```
>C:\Users\ddevienne>sqlite3
>SQLite version 3.28.0 2019-04-16 19:49:53
>Enter ".help" for usage hints.
>Connected to a transient in-memory database.
>Use ".open FILENAME" to reopen on a persistent database.
>sqlite> select
>   ...>cast(strftime('%s', '2016-06-13T09:36:34.123Z') as real) +
>   ...> strftime('%f', '2016-06-13T09:36:34.123Z') -
>   ...>cast(strftime('%S', '2016-06-13T09:36:34.123Z') as real)
>   ...> ;
>1465810594.123
>sqlite>
>```
>--
>Subscription info:
>https://sqlite.org/forum/alerts/54F6DD420B31FA7F9F69F5498F1631F5E6D4B48CF
>97539FDEEF90F71733E90A9
>___
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Fwd: [sqlite-forum] Convert datetime string to second since Epoch with millisecond precision

2020-03-17 Thread Dominique Devienne
Reposting to the ML, maybe I'll have more luck there, than in the forum?
--DD

-- Forwarded message -
From: ddevienne 
Date: Tue, Mar 17, 2020 at 5:09 PM
Subject: [sqlite-forum] Convert datetime string to second since Epoch with
millisecond precision
To: 


Forum post by ddevienne on 2020-03-17 16:09:17
https://sqlite.org/forum/forumpost/0d9c338ff1

Hi. Below does what I want, but surely there's a better way than parsing
the datetime 3 times? Because the below is ugly as hell. Thanks, --DD

```
C:\Users\ddevienne>sqlite3
SQLite version 3.28.0 2019-04-16 19:49:53
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> select
   ...>cast(strftime('%s', '2016-06-13T09:36:34.123Z') as real) +
   ...> strftime('%f', '2016-06-13T09:36:34.123Z') -
   ...>cast(strftime('%S', '2016-06-13T09:36:34.123Z') as real)
   ...> ;
1465810594.123
sqlite>
```
-- 
Subscription info:
https://sqlite.org/forum/alerts/54F6DD420B31FA7F9F69F5498F1631F5E6D4B48CF97539FDEEF90F71733E90A9
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users