0

I have this JS:

var d = new Date();
var year = d.getFullYear();
var month = d.getMonth();
var day = d.getDay();
var hours = d.getHours();
var minutes = d.getMinutes();
var seconds = d.getSeconds();
var milliseconds = d.getMilliseconds();
var timeStamp = year + '.' + month + '.' + day + '. ' + hours + ':' + minutes + ':' + seconds + ':' + milliseconds;

What it's outputting:

2015.10.5. 11:45:22:307

But what it should be outputting:

2015.11.5. 11:45:22:307

What is the problem with my script? Why the month is not correct?

Thank You for your help!

0

1 Answer 1

2

because getMonth method return the month from 0 to 11

http://www.w3schools.com/jsref/jsref_getmonth.asp

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.