I am pretty new to Google Apps Script, so please bear with me.
I am collecting daily interest rates from a bank on Google Sheets, and I am using the following code
Solution :
values[0][0] = Utilities.formatDate(new Date(), "GMT+10:00", "yyyy-MM-dd").setNumberFormat('yyyy-mm-dd');