Artur Reilin <[email protected]> wrote:
> So my problem is the following:
> 
> I store some gamedata in my database. Also time data how long you played
> the game.
> 
> That would be days, hours, minutes, seconds. My first try is to use a
> integer value, but the numbers doesn't get insert right and it change the
> numbers every time i save. Also double 00 are replaced with 0 zero and
> also gives a problem.
> 
> 7003344 = 7 days 00 hours 33 minutes 44 seconds.
> Later i have 0 days 7 hours 33 minutes 44 seconds.

Why don't you just store the time in seconds? E.g. 7 days, 33 minutes and 44 
seconds would become 606824:

(((7 * 24) + 0) * 60 + 33) * 60 + 44 == 606824

I'll leave the inverse calculations as an exercise for the reader. It should 
also be possible to (mis)use strftime('unixepoch') to extract individual pieces:

http://sqlite.org/lang_datefunc.html

-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to