Get today date in google appScript

后端 未结 5 1283
旧时难觅i
旧时难觅i 2021-02-01 15:48

How do I get the Today date on google appscript?

I need to write a code to input today´s date in a cell.

function changeDate(){
  var sheet = Spreadsheet         


        
5条回答
  •  鱼传尺愫
    2021-02-01 16:28

    The Date object is used to work with dates and times.

    Date objects are created with new Date()

    var now = new Date();
    

    now - Current date and time object.

    function changeDate() {
        var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(GA_CONFIG);
        var date = new Date();
        sheet.getRange(5, 2).setValue(date); 
    }
    

提交回复
热议问题