format sec - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: format sec (
/showthread.php?tid=280688)
format sec - Unknown123 - 02.09.2011
formatsec dont work

it givs me wrong answer
only the "days" works
pawn Код:
stock formatsec(secounds, &days, &months, &years)
{
days = secounds/3600/24;
months = secounds/5200/30;
years = secounds/360;
}
Re: format sec -
MadeMan - 02.09.2011
It's not that easy to make as months may have 28, 29, 30 or 31 days and years may have 365 or 366 days.
Re: format sec -
Lorenc_ - 02.09.2011
Make it a float, You'll be having a decimal number if so you're using all of the parameters stated.
pawn Код:
stock formatsec(secounds, &Float:days, &Float:months, &Float:years)
{
days = secounds/3600/24;
months = secounds/5200/30;
years = secounds/360;
}
( 10 [SECONDS] ) / 5200 / 30 = 6.41025641025641e-5
Re: format sec - Unknown123 - 02.09.2011
Ok, do you have amother sug how to do it, im trying to format from timestam to days, months, years..
Re: format sec -
MadeMan - 02.09.2011
Quote:
Originally Posted by Unknown123
Ok, do you have amother sug how to do it, im trying to format from timestam to days, months, years..
|
Why you need it? You can use getdate function.
https://sampwiki.blast.hk/wiki/Getdate
Re: format sec - Unknown123 - 02.09.2011
Quote:
Originally Posted by MadeMan
|
to tell the person when he will be unbanned
i did like this to find the days, and it works, but idk how to get months and years working
days = gettime() - timestamp/3600/24;
Re: format sec -
Vince - 02.09.2011
Is this what you're looking for?
http://forum.sa-mp.com/showthread.ph...ime#post939475
Re: format sec - Unknown123 - 02.09.2011
Quote:
Originally Posted by Vince
|
dont that make the timestamp?
i did somethinglike this now, but i dont get the rest
pawn Код:
stock tstodate(timestamp)
{
new string[128];
format(string, sizeof(string), "SELECT FROM_UNIXTIME(%d, '%Y %D %M')", timestamp);
mysql_query(string);
}
Re: format sec -
SloProKiller - 02.09.2011
Click here!
You should be able to use that instead, it works fine.
Re: format sec -
MadeMan - 02.09.2011
Quote:
Originally Posted by Unknown123
dont that make the timestamp?
|
The date() function is what you need.