Google-sheets – Duplicating sheets with simple date from a named range

google sheetsgoogle-apps-script

When I run the script to duplicate sheets with a date is give the tab a long date name Thu Oct 18 2018 00:00:00 GMT-0400 (EDT). I would like it to read in a 10/18/18 format.

Best Answer

Use Utilities.formatDate. Example from the link:

// This formats the date as Greenwich Mean Time in the format
// year-month-dateThour-minute-second.
var formattedDate = Utilities.formatDate(new Date(), "GMT", "yyyy-MM-dd'T'HH:mm:ss'Z'");
Logger.log(formattedDate);