Getting the date | Sololearn: Learn to code for FREE!


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.

12/12/2016 10:42:09 AM

Walter Musara

6 Answers

New Answer


Indeed, the first month it's 0. A quick solution it's add +1 to the result.


Can you provide the code you used? I suspect you're using an array.


How do you get number? Normally date() provides month as a name. You can use .format() to alter the output.


Search for the program:Christmas countdown to see the code Muhammad Kamal




Check code playground page, first example is "what a date now?". So very easy.