Reputation: 289
Data:
Result should be = 5/12/2013 18:41:00
I want an script that sum E3 + C3 and return the value. I needs this to integrate the information with other script.
I try to SUM using script, but in my research is needs some kwnowloge regarding milliseconds the date to bit or something like this to sum date.
The resuld should be in that format dd/mm/yyyy HH:MM:SS (24hs) because is used to call other script.
Workaround: Here
I will appreciate if anyone can help. I think this script will helpfully some much because is a general function.
Upvotes: 0
Views: 1582
Reputation: 16559
One option is to establish a formula, in a new cell, e.g.:
The following code sets the formula:
/* CODE FOR DEMONSTRATION PURPOSES */
function dateAdd() {
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = ss.getRange('C1').setFormula('A1+B1');
var formattedDate = Utilities.formatDate(range.getValue(), 'GMT', 'dd/MM/yyyy HH:mm:ss');
//Logger.log(formattedDate); <-- 05/12/2013 18:41:00
}
It is important to correctly define the timezone of the spreadsheet and script.
Upvotes: 1