var dateString = "20120515"; var year = dateString.substring(0,4); var month = dateString.substring(4,6); var day = dateString.substring(6,8); var date = new Date(year, month-1, day);