I want to add 5 days to a date string in Javascript:
var olddate = '23.12.2013';
olddate = olddate.split('.');
var tmpDate = new Date(olddate[2],olddate[1],olddate[0]);
tmpDate.setDate(tmpDate.getDate() + 5);
var date = (tmpDate.getDate().toString().length < 2) ? '0' +
tmpDate.getDate() : tmpDate.getDate();
var month = (tmpDate.getMonth().toString().length < 2) ? '0' +
tmpDate.getMonth() : tmpDate.getMonth();
console.log( date + '.' + month + '.'+ tmpDate.getFullYear());
This code shows 27.00.2014
instead of what I expect: 27.12.2013
. I would like to add 5 days to the String date. Why is this off by a month?