SA-MP Forums Archive
Mysql Date - 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: Mysql Date (/showthread.php?tid=579984)



Mysql Date - AroseKhanNiazi - 01.07.2015

How do i save date in mysql, i am using NOW() but how should i load these? in strings or integer and how could like
NOW()+days so it should save like
if it's 2015-07-01
so +7 days
2015-07-08


Re: Mysql Date - Suicidal.Banana - 01.07.2015

This is most likely the best solution: [Tutorial] How to: Unix timestamps

Unix timestamps (the kind used by sa-mp) are in seconds, easy to save/load, and you could just add 604800 seconds (7 days) to have a timestamp for a week in the future. If you dont feel like reading the tut.

Once you are using timestamps, you can turn the database column into a timestamp type if you plan on doing fancy stuff with the data outside of sa-mp, or just int will work too, and in sa-mp read it as integer.