SA-MP Forums Archive
Calculate Days. - 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: Calculate Days. (/showthread.php?tid=609886)



Calculate Days. - Spenker - 17.06.2016

how do I calculate the days from timestamp?
Код HTML:
stock Days(timestamp) { return (gettime( ) - timestamp) / 86400; }
Not work...
Exemple of timestamp: 1467387606


Re: Calculate Days. - Dayrion - 17.06.2016

Do you mean day, months, year ?
PHP код:
        gettime(hourminutesecond);
        
getdate(yearmonthday); 



Re: Calculate Days. - Matz - 17.06.2016

Код:
stock GetDays()
{
	new days = gettime();
	days = days/60/60/24;
	return days;
}



Re: Calculate Days. - Spenker - 17.06.2016

Quote:
Originally Posted by Matz
Посмотреть сообщение
Код:
stock GetDays()
{
	new days = gettime();
	days = days/60/60/24;
	return days;
}
Not work.
pMeanUser = 1467387606;
GetDays(pMeanUser);


Re: Calculate Days. - Dayrion - 17.06.2016

PHP код:
GetDay()
{
    new 
yearmonthday;
    
getdate(yearmonthday);
    return 
day;




Re: Calculate Days. - Matz - 17.06.2016

Quote:
Originally Posted by Spenker
Посмотреть сообщение
Not work.
pMeanUser = 1467387606;
GetDays(pMeanUser);
Код:
stock GetDays(days)
{
	days = days/60/60/24;
	return days;
}



Re: Calculate Days. - Konstantinos - 17.06.2016

pawn Код:
(timestamp - gettime()) / 86400
// or
(timestamp - gettime()) / 60 / 60 / 24
// or
(timestamp - gettime()) / (60 * 60 * 24)
where timestamp is equal to 1467387606. All three of them give 13 days.