Guest User

Untitled

a guest
Jan 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. function UpdateDates() {
  2. var ss = SpreadsheetApp.getActiveSpreadsheet();
  3. var sheet = ss.getActiveSheet();
  4. var row = SpreadsheetApp.getActiveRange().getRow
  5. //Get the dates from the cell and convert them into Milliseconds since 1970/01/01
  6. var First = new Date(ss.getRange('F4').getValue()).getTime();
  7. var Second = new Date(ss.getRange('F5').getValue()).getTime()
  8. var Third = new Date(ss.getRange('F6').getValue()).getTime();
  9. var dayInMs = 24*60*60*1000 //one day in Milliseconds
  10. //add sevendays to each date in milliseconds
  11.  
  12. First = First + (7*dayInMs)
  13. Second += (7*dayInMs)
  14. Third += (7*dayInMs)
  15.  
  16. //Convert Milliseconds to date use new Date(time in ms) and set Values of the cell
  17. ss.getRange('F4').setValue(new Date(First));
  18. ss.getRange('F5').setValue(new Date(Second));
  19. ss.getRange('F6').setValue(new Date(Third));
  20.  
  21. }
Add Comment
Please, Sign In to add comment