SQLite Forum

(Deleted)
Login

how to reverse julianday back to regular days and hours ?

(1) By monkelvin (kelvimchop) on 2021-10-15 12:33:07 updated by 1.1 [link] [source]

Say 


`SELECT julianday('2021-01-02 01:00:00')-julianday('2021-01-01 04:00:00')
`


= 2459216.5416666665 - 2459215.6666666665 = 0.875

How to transfer this '0.875' back to **hours**? 

For example, 10 days and 6 hours will be 10.25

how to reverse julianday back to regular days and hours ?

(1.1) By monkelvin (kelvimchop) on 2021-10-15 14:00:01 edited from 1.0 updated by 1.2 [link] [source]

Say 


`SELECT julianday('2021-01-02 01:00:00')-julianday('2021-01-01 04:00:00')
`
1 day and 3 hours will be 1.125 days

= 2459216.5416666665 - 2459215.6666666665 = 0.875 = julianday

How to transfer this 'julianday' back to **days**? 

For example, 10 days and 6 hours will be 10.25 days

EDIT: Better explanation

(1.2) By monkelvin (kelvimchop) on 2021-10-15 14:15:37 edited from 1.1 [link] [source]

Deleted

(2) By Ivan Tolstosheyev (itroot) on 2021-10-15 12:39:51 in reply to 1.0 [link] [source]

Will

sqlite> SELECT 0.875 * 24;
0.875 * 24 = 21.0
Run Time: real 0.000 user 0.000000 sys 0.000122
sqlite> 


work for you?

(3) By monkelvin (kelvimchop) on 2021-10-15 14:01:11 in reply to 2 updated by 3.1 [link] [source]

Sorry, I think I haven't explained it clearly.
I modify the post, if you may, please read the post again, thank you!

(3.1) By monkelvin (kelvimchop) on 2021-10-15 14:15:42 edited from 3.0 in reply to 2 updated by 3.2 [link] [source]

Deleted

(3.2) By monkelvin (kelvimchop) on 2021-10-15 14:15:57 edited from 3.1 in reply to 2 [source]

Thank you ! Problem solved

(4) By David Jones (vman59) on 2021-10-15 14:33:46 in reply to 1.1 updated by 4.1 [link] [source]

Where are you getting '1 day and 3 hours'? It should be '1 day minus 3 hours'.

   2-jan-2021 01:00:00
 - 1-jan-2021 04:00:00
------------------------
    (1 day) - 03:00:00  = 24:00:00 - 03:00:00 = 21:00:00

(4.1) By David Jones (vman59) on 2021-10-15 14:33:59 edited from 4.0 in reply to 1.1 [link] [source]

Deleted