I want to concatenate two cell values. Example:
Cell Date has Value: 5/11/2020. Cell Time has Value:14:00. Final Cell should be: 2020-05-11 14:00:00.
The way I am doing this is with:
sheetDestination.getRange(9,7).setValue(shiftDate + shiftTime);
The output ends up being:
Mon May 11 2020 00:00:00 GMT-0400 (Eastern Daylight Time)Range.
function shiftDuration () {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheetDestination = spreadsheet.getSheetByName("NewToImport");
//Time Diff
var timeStartforShift = sheetDestination.getRange(2, 4).getDisplayValue(); //start time
var timeEndforShift = sheetDestination.getRange(5, 5).getDisplayValue(); //end time
var shiftDuration = Math.floor(parseInt(timeEndforShift) - parseInt(timeStartforShift));
//create a new row to test concatenating date and time
var rangeDurantionToCopy = sheetDestination.getRange(1, 1, 2,
sheetDestination.getMaxColumns());
rangeDurantionToCopy.copyTo(sheetDestination.getRange(8,1));
var shiftEndTime = sheetDestination.getRange(9,5).setValue(timeStartforShift + (shiftDuration * 60));
var shiftDate = sheetDestination.getRange(9,3).getValue();//get the Date for the shift
sheetDestination.getRange(9,7).setValue(shiftDate + shiftEndTime);
}
Below is the function. I am adding a picture of the sheet. Basically the schedule shows a shift (4-hour shift), each row indicates 1 hour for the same shift.
I am trying to make it 1 row with start and end time which to show is a 4 hours shift. For example from 10 am - 2 pm, and there is a cell that needs to have the Date + Time (which is outputting so wrong!)

setValuemethod that you try to use it in string concatenation? - Oleg Valter is with Ukraine