Time and Date function
#1

So I'm struggling with this, this function is supposed to give me a time and a date and it works but the only problem is seconds/minutes etc..

So if time is 12:01:20 the function will retrun me this 12:1:20 i don't know why is that, if there is 0 before secon it will left it blank, hope you understand what i'm talking about... :P

pawn Код:
stock TimeDate()
{
    new
        day,
        month,
        year,
        hour,
        minute,
        second,
        string[50];

    getdate(year, month, day);
    gettime(hour, minute, second);

    format(string, sizeof(string), "%d/%d/%d u %d:%d:%d", day, month, year, hour, minute, second);
    return string;
}
Reply
#2

%02d
Reply
#3

Every %d to change to %02d ?
Reply
#4

Yep.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)