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

0

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

+3

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

+1

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

+1

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

+1

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

0

ok

0

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