Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Formatting a number format to date in Google App Scripts

$
0
0

I have a script that changes the name of a sheet based on a cell in that sheet. Which works. But I am trying to change the sheet name to a particular date format - 'August 1, 2022'. But the sheet name appears as 'Tue Aug 01 2028 08:00:00 GMT+0100 (British Summer Time)' I have tried to add the code '.setNumberFormat('dd.MM.yyyy');' to my code but this doesn't work.

Any ideas? My current code is

function changeSheetName( ){var As = SpreadsheetApp.getActiveSpreadsheet( ).getActiveSheet( )As.setName(As.getRange("A1").getValue( ) ).setNumberFormat('dd.MM.yyyy');}

function onEdit( ){changeSheetName( )}


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>