Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function UpdateDates() {
- var ss = SpreadsheetApp.getActiveSpreadsheet();
- var sheet = ss.getActiveSheet();
- var row = SpreadsheetApp.getActiveRange().getRow
- //Get the dates from the cell and convert them into Milliseconds since 1970/01/01
- var First = new Date(ss.getRange('F4').getValue()).getTime();
- var Second = new Date(ss.getRange('F5').getValue()).getTime()
- var Third = new Date(ss.getRange('F6').getValue()).getTime();
- var dayInMs = 24*60*60*1000 //one day in Milliseconds
- //add sevendays to each date in milliseconds
- First = First + (7*dayInMs)
- Second += (7*dayInMs)
- Third += (7*dayInMs)
- //Convert Milliseconds to date use new Date(time in ms) and set Values of the cell
- ss.getRange('F4').setValue(new Date(First));
- ss.getRange('F5').setValue(new Date(Second));
- ss.getRange('F6').setValue(new Date(Third));
- }
Add Comment
Please, Sign In to add comment