In netsuite sometimes when we get the value of date will be with weekday+date+timezone. In order to change this value to your corresponding date format. This function may help you to change the date to YYYY-MM-DD format.You can change the format by just changing the string in the datestring varible
function generateDateString(dateObj) {
//convert date to specific format
var date = dateObj;
log.debug("date", date)
var d = date.getDate();
log.debug("d", d);
var m = date.getMonth() + 1;
log.debug("Month: ", m)
var y = date.getFullYear()
log.debug("Year: ", y)
var dateString = (y + '-' + (m <= 9 ? '0' + m : m) + '-' + (d <= 9 ? '0' + d : d));
log.debug("datestring: ", dateString);
return dateString;
}