Convert New Date back to date format - Apps script

26 views Asked by At

I have this code..

mainSheet.getRange(lastRow+1,2)
        .setValue(new Date().toLocaleString('en', {timeZone: 'America/New_York'}))
        .setNumberFormat("MM/dd/yyyy hh:mm:ss A/P")
        .setHorizontalAlignment("left")
        .setFontSize(10);

the output is 4/10/2023, 9:33:13 AM, a string.. I want it to convert it back to date format so I can use it. How do I do that?

0

There are 0 answers