date() returning wrong month

Started by Eva, Mar 09, 2017, 02:46 PM

Previous topic - Next topic

Eva

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

KAKAN

Configure your VPS's date and time.
oh no

Murdock

According to the squirrel docs 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