I want to record when an App Script run inside a spreadsheet. This time will be used by other formulas in the spreadsheet, to calculate the time between now and the last time the app script has run.
The formulas on the spreadsheet use the NOW() function, which returns a decimal number of days since 30/12/1899. The timezone of this epoch is dependent on the timezone of the sheet, see 18596933.
I need to use App Script to insert the current time into a spreadsheet cell using the same format as NOW(). I have been trying to use Javascript Date's to do this, however these dates are based on the App timezone, which may be different from that of the spreadsheet.
How can I create a App Script version of NOW(), which returns the same value as NOW() regardless of spreadsheet or script timezone differences?