L.L
L.L

Reputation: 3

Get the Date from three cells (year, month and day) on spreadsheet by using google script

I am trying to do the function below:

  1. Input the year, month and day into three corresponding cells on the spreadsheet.(say A1, B1, C1 = 2016, 7, 28)

  2. Generate the events on that day on the spreadsheet

I know that the Date format of google script is Date('July 20, 2015 20:00:00 UTC'). However, could I get the date without converting the month to string?

Upvotes: 0

Views: 74

Answers (1)

Wicket
Wicket

Reputation: 38160

Short answer

var date = new Date(2016, 7, 29);

Explanation

From: https://developers.google.com/apps-script/overview

Google Apps Script is a scripting language based on JavaScript that lets you do new and cool things with Google Apps like Docs, Sheets, and Forms.

So to create a Date object on Google Apps Script it's possible to use any of the valid syntaxes to call Date as a constructor.

References

Upvotes: 1

Related Questions