Reputation: 9
So I made an HTML file in the Script, where it will take the data from the Google sheet (after I enter the data in Google sheet). But if I enter Sept 6, 2020, in the Google Sheet, somehow the email sent out shows "Sep 06, 2020, 00:00:00 GMT+0530 (India Standard Time)". Why is this happening? How do I fix it?
<!DOCTYPE html> <html> <head>
<base target="_top"> </head> <body>
<p>Hey <?= meta.name ?>!</p>
<p>It's exciting to have you onboard (company name) !</p>
<p>We're pleased to share that your project match has been confirmed and you've been matched with <b>Project <?= meta.project ?></b>.
<b><?= meta.mentorName ?> will be your mentor</b> and you're scheduled to start our program for <b>12 weeks on <?= meta.startDate ?></b>. </p>
Upvotes: 0
Views: 154
Reputation: 5243
Most probably because you are not formatting the date the way you want it. By default, Apps Script formats the date in the output you are seeing it. In order to format the date to an output you wish, you have to use the date format utility.
// 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);
Upvotes: 1