Here's a version that finds the column using the header, rather than hardcoding the column number, and uses a custom time zone:
function updateModified(options) {
var sheet = SpreadsheetApp.getActiveSheet();
if (options.sheetName && sheet.getName() != options.sheetName) {
return;
}
var modifiedColumnName = options.modifiedColumnName || 'Modified';
var header = sheet.getDataRange().offset(0, 0, 1).getValues()[0];
var modifiedColumn;
for (var i=0; i < header.length; i++) {
if (header[i].trim() == modifiedColumnName) {
modifiedColumn = i + 1;
break;
}
}
if (typeof modifiedColumn != 'number') {
throw new Error("Can't find column with name: " + modifiedColumnName);
}
var activeCell = sheet.getActiveCell();
if (activeCell.getColumn() == modifiedColumn) {
return;
}
var modifiedCell = sheet.getRange(activeCell.getRow(), modifiedColumn);
var formattedDate = Utilities.formatDate(new Date(), "America/Los_Angeles", "M/dd/yy HH:mm");
modifiedCell.setValue(formattedDate);
}
function onEdit() {
updateModified({sheetName: 'Jobs'});
}
To use UTC, just change the time zone to UTC.