[HELP] mysql saving 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: [HELP] mysql saving date (
/showthread.php?tid=518006)
[HELP] mysql saving date -
Luca12 - 07.06.2014
Hello how can I save date format in mysql like 07/06/2014 beacuse recenty I was trying to do and nothing I was set that to varchar in mysql table and from first somehow it won't work with this // and I was put llike %d%d%d day,month,year and then in mysql table last activity it was I think 2014-6-7 but I want 07/06/2014 if you know what I mean in that format I was trying everything but I didn't manage to work it out? Thanks
Re: [HELP] mysql saving date -
kamiliuxliuxliux - 07.06.2014
I don't think it's possible, unless you use another field for each parameter.
Re: [HELP] mysql saving date -
Vince - 07.06.2014
http://dev.mysql.com/doc/refman/5.5/...on_date-format
MySQL stores timestamps in its own specific format. There is no way to change the representation in the table, but frankly it doesn't matter. You convert the timestamp to the format you need, when you need it.
Re: [HELP] mysql saving date -
Luca12 - 07.06.2014
but how then was in one field this 7-6-2014 but I want it 7/6/2014
edit: is it possible to edit the timestamp to format which I need I know use timestamp and goes like 2014-6-7 and there in that field also are time but I don't want that just date. Thanks
Re: [HELP] mysql saving date -
Vince - 07.06.2014
PHP код:
select date_format('2014-6-7', '%e/%c/%Y')
PHP код:
select date_format(yourDateField, '%e/%c/%Y') from yourTable
Note that you must escape the '%' symbols if you use them in a format statement in Pawn;
pawn Код:
format(query, sizeof(query), "select date_format(yourDateField, '%%e/%%c/%%Y') from yourTable where id = %d", playersqlid);
Re: [HELP] mysql saving date -
Luca12 - 07.06.2014
where that is go and from your table are you mean on that variable on name of column which is lastactivity and is it a way to remove the time and just leave date.
Re: [HELP] mysql saving date -
Vince - 07.06.2014
Why do I honestly still bother. Go and read that page I linked. There are a bunch of examples there. Or ask ******.
Re: [HELP] mysql saving date -
Luca12 - 07.06.2014
I understand more or less how to do it just one more question is that select etc.. go under onplayerdisconnect