views:

33

answers:

2

How would you convert secs to HH:MM:SS format in SQLite?

A: 

Well, i would do something like this, but i'm getting hours plus 12...

SELECT strftime('%H-%M-%S', CAST(<seconds here> / 86400.0 AS DATETIME)) 

-- For subtracting the 12 hours difference :S
SELECT strftime('%H-%M-%S', CAST(<seconds here> / 86400.0 AS DATETIME) - 0.5) 
Jhonny D. Cano -Leftware-
I think it is adjustjing for the start of the epoch. I know it can work, I will work it out.
vfclists
well, thanks for the nudge !! I thought nobody was going to answer so I dropped it out
Jhonny D. Cano -Leftware-
+1  A: 

Try this one:

sqlite> SELECT time(10, 'unixepoch');
00:00:10
newtover
This is what I thought originally but used strftime instead of time
vfclists