Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Eva on Mar 09, 2017, 02:46 PM

Title: date() returning wrong month
Post by: Eva on Mar 09, 2017, 02:46 PM
Hi i have this problem with date() returning the wrong month

else if ( cmd == "time" )
{
local now = date();
Message( COLOR_MOV+"The time is currently " + now.day + "/" + now.month + "/" + now.year + " " + now.hour + ":" + now.min + ":" + now.sec + "" );
}

What is wrong here? it returns the previous month instead
Title: Re: date() returning wrong month
Post by: KAKAN on Mar 09, 2017, 03:07 PM
Configure your VPS's date and time.
Title: Re: date() returning wrong month
Post by: Murdock on Mar 09, 2017, 03:12 PM
According to the squirrel docs (http://www.squirrel-lang.org/doc/sqstdlib3.html#d0e1938) the .month property returns the month as month index (0-11)
Quotemonth   Month (0 - 11; January = 0).
So simply add +1 to get the current month number