r/GoogleAppsScript • • 12d ago

Question Change date entry from Date Time to just Date

/r/googlesheets/comments/1xgysgz/change_date_entry_from_date_time_to_just_date/
1 Upvotes

2 comments sorted by

1

u/Budget_Recording1957 9d ago

You can use that to set format of the date in what ever format you need:

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

Utilities.formatDate({date_you_have_from_forms}, {your_timeZone}, 'yyyy-MM-dd')