var yourDate = "20130501", newDate = new Date(yourDate .slice(0, 4) + " " + yourDate .slice(4, 6) + " " + yourDate .slice(6, 8)).getTime(); newDate = new Date(newDate - 2.4e4); alert(newDate);