split a date using sscanf
#1

I want to split a date for example 2015-11-26 using sscanf , I did a code but not working

pawn Код:
CMD:tests(playerid,params[])
{
    new s[128];
    new date[3]; // date[0] = day       date[1] = month         date[2] = year
    if(sscanf(params,"p<.>iii",date[2],date[1],date[0]))
    {
    format(s,sizeof(s),"Test: %i %i %i ",date[2],date[1],date[0]);
    SendClientMessage(playerid,_COLOR_AQUA,s);
    }
    return 1;
}
wanna fix , thanks in advance .
Reply
#2

replace the sscanf line with this:
pawn Код:
if(!sscanf(params,"p<->iii",date[2],date[1],date[0]))
Reply
#3

thank you so much its working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)