I am trying to get the date into App Scripts but eventually, it is getting a date with time and time zone which I really don't want to. here is what I code.
function sendMail(){
var first = 0;
var order = 1;
var date = 2;
var item = 3;
var email = 4;
var pesa = 5;
var aliases = GmailApp.getAliases();
var emailTemp = HtmlService.createTemplateFromFile("email");
var ws = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("NAJ");
var data = ws.getRange("A2:F" + ws.getLastRow()).getValues();
data.forEach(function(row){
emailTemp.fn = row[first]
emailTemp.oid = row[order]
emailTemp.odate = row[date]
emailTemp.itm = row[item]
emailTemp.amt = row[pesa]
var htmlMessage = emailTemp.evaluate().getContent();
GmailApp.sendEmail(
row[email],
"Your Order Recently Canceled",
"Your email doesn't support HTML",
{'from':aliases[4], name: "My company name", htmlBody: htmlMessage}
);
});
}
this showing the date in below format
Thu Feb 25 2021 14:00:00 GMT-0500 (Eastern Standard Time)
i only want it to be
25/01/2021
or
01/25/2021
Here is the HTML
<p>Hi <?= fn ?>,</p>
<p>I hope you are well. We notices you recently tried to place an order on <a href="www.xyz.com">My Company Name</a>, and it got canceled before completion.</p>
<p>Let me know if you need any assistance with placing an order; I will be delighted to help you.</p>
<p>Below is your canceled order details:</p>
<p><strong>Order# <?= oid ?></strong></p>
<p><strong>Date: <?= odate ?></strong></p>
<p><strong>Item: <?= itm ?></strong></p>
<p><strong>Total Amount: $<?= amt ?></strong></p>
any help will highly be appreciated