Posts: 1,018
Threads: 320
Joined: Jul 2010
Hello I have in LastActivity column is set to timestamp and it saves on disconnect in format like 2014-07-20 18:12:33
so I want there only date and in format 20/07/2014 is this possible to make I try everything but it won't work. Thanks
Posts: 1,018
Threads: 320
Joined: Jul 2010
is this fine? I mean is it work
pawn Код:
mysql_format(mysql,query,sizeof(query),"select date_format(LastActivity,'%%e/%%c/%%Y') FROM `users` WHERE `ID` = '%d'",PlayerInfo[playerid][ID]);
mysql_tquery(mysql,query,"","");
Posts: 1,018
Threads: 320
Joined: Jul 2010
20.07.2014, 17:12
(
Последний раз редактировалось Luca12; 20.07.2014 в 17:49.
)
Quote:
Originally Posted by Vince
PHP код:
SELECT DATE(LastActivity) AS LastActivity FROM table WHERE ...
Very easy.
|
I will try it then
I'm sorry instead of edit existing post I make the new one sorry for dp(double post)
edit: I try and in the column still stays 2014-07-20 19:47:10
also I was try like this
pawn Код:
mysql_format(mysql,query,sizeof(query),"SELECT DATE_FORMAT(LastActivity,'%e/%c/%Y') FROM `users` WHERE `ID` = '%d'",PlayerInfo[playerid][ID]);
mysql_tquery(mysql,query,"","");
and I get this in mysql_log
20:12:34 mysql_format ERROR no value for specifier "%c" available
20:12:34 mysql_format ERROR no value for specifier "%Y" available
Posts: 1,018
Threads: 320
Joined: Jul 2010
Posts: 125
Threads: 10
Joined: May 2011
Reputation:
0
Ok, the problem is that you have to escape the '%' symbol. For that, put a \%
mysql_format(mysql,query,sizeof(query),"SELECT DATE_FORMAT(LastActivity,'\%e/\%c/\%Y') FROM `users` WHERE `ID` = '%d'",PlayerInfo[playerid][ID]);
mysql_tquery(mysql,query,"","");
Posts: 1,018
Threads: 320
Joined: Jul 2010
problem still remains it says
mysql_format ERROR no value for specifier "%c" available
mysql_format ERROR no value for specifier "%Y" available
Thanks.
Posts: 1,018
Threads: 320
Joined: Jul 2010
Posts: 1,018
Threads: 320
Joined: Jul 2010
Posts: 1,018
Threads: 320
Joined: Jul 2010
Posts: 639
Threads: 92
Joined: Jul 2011
Reputation:
0
Perhaps try only bumping your post once, as the rules state?
On topic: try just using %d as it's numerical. I may be wrong, I haven't used timestamps much with MySQL
Posts: 1,018
Threads: 320
Joined: Jul 2010
Posts: 584
Threads: 51
Joined: Jan 2014
Reputation:
0
I see why you've got -7 rep.
Posts: 1,018
Threads: 320
Joined: Jul 2010
Posts: 1,018
Threads: 320
Joined: Jul 2010