Getting the date

why does the function of getting the month give you an answer one month smaller.?example I wanted to get December which is the 12th month but instead it gave me an integer of 11.

12th Dec 2016, 10:42 AM
Walter Musara
Walter Musara - avatar
6 Answers
+ 3
Indeed, the first month it's 0. A quick solution it's add +1 to the result.
12th Dec 2016, 11:02 AM
Nahuel - avatar
+ 1
Can you provide the code you used? I suspect you're using an array.
12th Dec 2016, 10:56 AM
Muhammad Kamal
Muhammad Kamal - avatar
+ 1
How do you get number? Normally date() provides month as a name. You can use .format() to alter the output.
12th Dec 2016, 12:20 PM
Andrey Kitsa
Andrey Kitsa - avatar
+ 1
Search for the program:Christmas countdown to see the code Muhammad Kamal
12th Dec 2016, 1:21 PM
Walter Musara
Walter Musara - avatar
12th Dec 2016, 12:46 PM
Dayne - avatar
Check code playground page, first example is "what a date now?". So very easy.
12th Dec 2016, 3:23 PM
IlyaBelgradsky - avatar