|
Veteran Member
|
06-23-2018
, 16:15
Re: Expiration Date in default admin plugin
|
#9
|
Quote:
Originally Posted by Kushfield
What exactly is the output?
You're making that stock way more complicated than it has to be by the way:
PHP Code:
stock getExpirationDate(duration) {
new szExpirationDate[15];
format_time(szExpirationDate, charsmax(szExpirationDate), "%Y%m%d", get_systime() + (duration * 86400));
return str_to_num(szExpirationDate);
}
Not sure why you return a str_to_num if you do a num_to_str on it right after.
Also, to automatically add a leading zero to an integer if it's a 1-digit number, you can use the following format:
PHP Code:
formatex(szExpirationDate, charsmax(szExpirationDate), "%d%02d%02d", year, month, day);
|
Thank you
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here
|
|
|
|