SA-MP Forums Archive
SQLite Hours/Minutes/Seconds - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQLite Hours/Minutes/Seconds (/showthread.php?tid=395661)



SQLite Hours/Minutes/Seconds - Hardwell - 27.11.2012

Hello,i want a tutorial about how to save Hours/Minutes/Seconds on SQLite.

Thanks!


Re: SQLite Hours/Minutes/Seconds - park4bmx - 27.11.2012

search more
https://sampforum.blast.hk/showthread.php?tid=262417


Re: SQLite Hours/Minutes/Seconds - Hardwell - 27.11.2012

thx..but i need a tutorial..about HOURS/MINUTES/SECONDS...not this


Re: SQLite Hours/Minutes/Seconds - iggy1 - 27.11.2012

Just save it as you would save any other string.


Re: SQLite Hours/Minutes/Seconds - Hardwell - 27.11.2012

yes..but need to create timers...and i do not know how to create this..


Re: SQLite Hours/Minutes/Seconds - Vince - 27.11.2012

pawn Код:
new time = gettime()
Time and date, saved in an integer value. You will need something to decode the unix timestamp, though, as I don't think SQLite supports that functionality.


Re: SQLite Hours/Minutes/Seconds - Konstantinos - 27.11.2012

There are two ways, first with a timer and get the hours/minutes/seconds by using that function and the second way is by using "gettime". The links are both with an example of each way.


Re: SQLite Hours/Minutes/Seconds - iggy1 - 27.11.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
pawn Код:
new time = gettime()
Time and date, saved in an integer value. You will need something to decode the unix timestamp, though, as I don't think SQLite supports that functionality.
You don't have to decode it if you pass vars by reference.

From the wiki:
pawn Код:
new Hour, Minute, Second;
gettime(Hour, Minute, Second);
printf("%02d:%02d:%02d", Hour, Minute, Second);



Re: SQLite Hours/Minutes/Seconds - Vince - 27.11.2012

You only store the integer value in the table, not the individual variables. So yes, you do need to decode it.


Re: SQLite Hours/Minutes/Seconds - iggy1 - 27.11.2012

Not if you store the time/date as a string.

EDIT: I see what you mean vince, for things like time played it should really be stored as integer, but if it's for something like join date it would be better to store as a string, then you don't need to use a function to convert it when the value will never change.