MySQL / DATE_FORMAT
#1

Hello guys, I'm experiencing a small problem.
I'm using mysql r39-2 plugin.
When a player logs onto his account I send a query to update their last login time

pawn Код:
mysql_format(MC, query, sizeof(query), "UPDATE players SET IP = '%s', LastLogin = NOW() WHERE Name = '%s'", PlayerIP[playerid], Name[playerid]);
        mysql_tquery(MC, query);
The type of the field in the database is datetime so it looks like
Код:
2015-03-17 17:00:03
As I want to return ingame in this format: March 17, 2015 17:00:03 I tried to use the date_format function, but I'm not sure how to take the result and send it as a message ingame.
So far I did this:

pawn Код:
mysql_query(MC, "SELECT DATE_FORMAT( 'LastLogin' , '%%M %%d %%Y %%h:%%i:%%s' ) AS `LastLogin` FROM `players` WHERE `Name` = '%s' LIMIT 1", Name[playerid]);
So I need help about how to take the result and send it. So instead of:
Код:
Welcome back, your last login was on 2015-03-17 17:00:03
It will be:
Код:
Welcome, back your last login was on March 17 2015 17:00:03
Thanks in advance.
Reply


Messages In This Thread
MySQL / DATE_FORMAT - by Wizzy951 - 21.03.2015, 01:04
Re: MySQL / DATE_FORMAT - by electrux - 21.03.2015, 09:32
Re: MySQL / DATE_FORMAT - by mirou123 - 21.03.2015, 09:35
Re: MySQL / DATE_FORMAT - by rickisme - 21.03.2015, 10:13
Re: MySQL / DATE_FORMAT - by Wizzy951 - 21.03.2015, 18:49
Re: MySQL / DATE_FORMAT - by Vince - 21.03.2015, 19:42

Forum Jump:


Users browsing this thread: 1 Guest(s)