Timestamp to string.
#4

Quote:
Originally Posted by RedCounty
Посмотреть сообщение
It's simple, look into the following:

gettime
getdate

and

format

Here is an example;

pawn Код:
stock NewDate()
{
    new Year, Month, Day, string[30];
    getdate(Year, Month, Day);
    format(string, sizeof(string), "%02d/%02d/%d", Day, Month, Year);
    return string;
}
and:

pawn Код:
stock NewTime()
{
    new Hour, Minute, Second, string[30];
    gettime(Hour, Minute, Second);
    format(string, sizeof(string), "%02d:%02d:%02d", Hour, Minute, Second);
    return string;
}
Then use this:

format(string, sizeof(string), "[%s - %s] ...", NewDate(), NewTime());
SendClientMessage(playerid, -1, string);

^^ - would print as:

[15/01/2015 - 18:27] ...
Clearly you didn't understand what the man asked.
You will be able to convert timestamp to date with this include:
https://sampforum.blast.hk/showthread.php?tid=347605
Reply


Messages In This Thread
Timestamp to string. - by Baltimore - 15.01.2015, 17:41
Re: Timestamp to string. - by RedCounty - 15.01.2015, 17:44
Re : Timestamp to string. - by Baltimore - 15.01.2015, 17:56
Re: Timestamp to string. - by dominik523 - 15.01.2015, 18:10
Re : Timestamp to string. - by Baltimore - 15.01.2015, 18:17
Re: Timestamp to string. - by dominik523 - 15.01.2015, 18:31
Re: Timestamp to string. - by Jefff - 16.01.2015, 16:32
Re: Timestamp to string. - by xVIP3Rx - 16.01.2015, 16:37
Re : Timestamp to string. - by Baltimore - 16.01.2015, 23:36

Forum Jump:


Users browsing this thread: 2 Guest(s)