Cant display FROM_UNIXTIME?
#1

Hello, i have a problem to dispay a result sql with FROM_UNIXTIME

My code

PHP код:
stock GetDateUnban(timestamp)
{
    new 
query[128];
    
format(querysizeof(query),"SELECT FROM_UNIXTIME(%d,'%d %m %Y %H:%I' )",timestamp);
    
mysql_query(query);
    
mysql_store_result();
    new 
result[15];
    
mysql_fetch_row(result);
    
mysql_free_result();
    return 
result;

And when i want to display this result sql

PHP код:
format(stringsizeof(string), "Unban : %s",GetDateUnban(1344800906));
ShowPlayerDialog(playerid,MESSAGE,DIALOG_STYLE_MSGBOX,"Unban Test",string,"OK","Close"); 
He dont display, he display an empty code or he display "Unban: d m Y H i"

Thx for your help and sorry my english is bad
Reply
#2

To format a literal percent sign into a string, it must be doubled. I think it should work like this:

pawn Код:
format(query, sizeof(query), "SELECT FROM_UNIXTIME(%d, '%%d %%m %%Y %%H:%%I')", timestamp);
Reply
#3

Nice works now +1 thx!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)