date_format

[CODE]@@ -303,7 +303,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)

 uint32 security = 0;	

 std::string last_login = GetTrinityString(LANG_ERROR);	
  • QueryResult result = LoginDatabase.PQuery("SELECT a.username,aa.gmlevel,a.email,a.last_ip,a.last_login "
  • QueryResult result = LoginDatabase.PQuery("SELECT a.username,aa.gmlevel,a.email,a.last_ip,DATE_FORMAT(a.last_login, ‘%d.%m.%Y %H:%i:%s’) "

                                            "FROM account a "	
    
                                            "LEFT JOIN account_access aa "
    
                                            "ON (a.id = aa.id) "[/CODE]
    

Whats wrong with this code? Its causing server crash, maybe I should use "%d.%m.%Y %H:%i:%s" - or where is problem? thanks

I see no sense in doing what you try to do, but here’s a solution nonetheless.

C++ assumes the ‘%d.%m.%Y %H:%i:%s’ in the string are vsprintf targets, so it tries to parse any variable arguments you might have added there. To avoid this, simply add another % sign, like this: ‘%%d.%%m.%%Y %%H:%%i:%%s’.

Thanks, it works ;-).