Convert Seconds To Days Hours Minutes And Seconds
#1

Hello, i have problem with convert seconds.
Код:
stock VipTime(Seconds)
{
	new String[150];
	new Days,Hours,Minutes;
	Days = Seconds / 60 / 60 / 24;
	Hours = Seconds - (Days * 60 * 60 * 24) / 60 / 60;
	Minutes = Seconds - (Hours * 60 * 60) / 60;
	Seconds = Seconds - (Minutes * 60);
	format(String,150,"%d d, %d h, %d m i %d s",Days,Hours,Minutes,Seconds);
	return String;
}
This do not work, please help.
Reply
#2

Found this:
http://forum.sa-mp.com/showpost.php?...&postcount=973
Reply
#3

Ok i do
Код:
stock VipTime(Seconds)
{
	new String[150];
	new Minutes,Hours,Days;
	if(Seconds > 59)
	{
		Minutes = Seconds / 60;
		Seconds = Seconds - (Minutes * 60);
	}
	if(Minutes > 59)
	{
		Hours = Minutes / 60;
		Minutes = Minutes - (Hours * 60);
	}
	if(Hours > 23)
	{
		Days = Hours / 24;
		Hours = Hours - (Days * 24);
	}
	format(String,150,"%d dni, %d godzin, %d minut i %d sekund",Days,Hours,Minutes,Seconds);
	return String;
}
Thanks you for answer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)