Quote:
Originally Posted by Mr.Freeman
Never thought of that Powerlord, would there be way to fetch date through sourcemod like the Time function. I was looking at a UNIX Timestamp style from MYSQL ( https://forums.alliedmods.net/showthread.php?t=162537) but I would prefer the month to change automatically without the need for MYSQL. New to this system, if you require the source i can upload what I have to help make it easier to understand my request.
Thanks,
Freeman
|
SourcePawn has things for dealing with UNIX timestamps.
GetTime returns a UNIX Timestamp.
FormatTime turns a UNIX timestamp into a formatted string. If you don't pass a timestamp to FormatTime, it uses the current time.
So, if you wanted to get the month as a number...
PHP Code:
new month;
new String:strMonth[3];
FormatTime(strMonth, sizeof(strMonth), "%m")
month = StringToInt(strMonth);
Edit: If you're wondering where "%m" came from, it's because FormatTime uses the C
strftime system call, which has a bunch of formatting strings defined. %m is "month as a decimal number (01-12)"
__________________