function firstbreak() {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.getRange(1,3).setValue(new Date).setNumberFormat("h:mm AM/PM")
}
我有功能正常工作,将单元格设置为当前时间。我怎样才能得到设置单元格为当前时间+15分钟的功能?
我建议
function firstbreak() {
var sheet = SpreadsheetApp.getActiveSheet();
var now = new Date();
var fifteenMinutesLater = new Date(now.getTime() + (15 * 60 * 1000));
sheet.getRange(1, 3).setValue(fifteenMinutesLater).setNumberFormat("h:mm AM/PM");
}