I\'m trying to use JS to turn a date object into a string in YYYYMMDD format. Is there an easier way than concatenating Date.getYear()
date object
YYYYMMDD
Date.getYear()
var someDate = new Date(); var dateFormated = someDate.toISOString().substr(0,10); console.log(dateFormated);