11
For example:
var data:Date = new Date();
trace(data.month); //Supondo que o mês seja Janeiro: 0
I would like some details, because I know that it is not only in Actionscript and Javascript that this happens. Why not simplify the month counter so that in a conversion it is easy to understand, getting the numbers returned exactly as the months of the year (January = 1, February = 2, March = 3)?
Because we always have to decrease 1:
var dataStr:String = "28/04/2014";
var data:Date = new Date(dataStr.substr(6,4), (dataStr.substr(3,2)-1), dataStr.substr(0,2), 0, 0, 0);
trace(data.month); //3
Why does this happen?
Because
data.month
is an array and every array starts from scratch, I believe this is it.– Silvio Andorinha
@Silvioandorinha What if the day of the month starts at 1 because it is not an array? Anything that is an array so you can assign a value to each element ex: 0=>"January" or 0=>"Monday" starts at 0?
– Jorge B.
@Jorgeb. commenting
– Silvio Andorinha