Younis Qadir
Younis Qadir

Reputation: 435

jquery converting to utc and iso date

I am converting a date to utc and iso in jquery but always it returns one month after after the date that i gave, here is my code

var x = new Date(2015,09,1).toISOString();

and here is the result

x = "2015-09-30T21:00:00.000Z"

for UTC also returns one month after.any help thanks

Upvotes: 0

Views: 322

Answers (1)

Nishith Kant Chaturvedi
Nishith Kant Chaturvedi

Reputation: 4769

Date starts from zero (0) ,so you should subtract 1 to get actual date...means for 0 corresponding to January in date

Upvotes: 1

Related Questions