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()
If using AngularJs (up to 1.5) you can use the date filter:
var formattedDate = $filter('date')(myDate, 'yyyyMMdd')