Issue with timezone

Sathwik1
Tera Guru

My instance is in Australia/West Timezone, and I use below code...  after record creation... frond end time and backend XML timings are different,, I want both frontend and backend start time should be 6:00:00 and 10:00:01

var daysToCreate = 60;
var gdt = new GlideDateTime();

for (var i = 1; i <= daysToCreate; i++) {

    gdt.addDaysLocalTime(1);

    var day = gdt.getDayOfWeekLocalTime();

    if (day < 2 || day > 5) {
        continue;
    }

    var dateStr = gdt.getLocalDate().toString();

    createSlot(dateStr, "06:00:00", "10:00:00");
    createSlot(dateStr, "10:00:01", "14:00:00");
}

function createSlot(date, startTime, endTime) {

    var start = new GlideDateTime();
    start.setDisplayValue(date + " " + startTime);

    var end = new GlideDateTime();
    end.setDisplayValue(date + " " + endTime);

    var check = new GlideRecord('u_deploy');
    check.addQuery('u_start_time', start);
    check.setLimit(1);
    check.query();

    if (check.next()) {
        return;
    }

    var slot = new GlideRecord('u_deploy');
    slot.initialize();
    slot.u_start_time = start;
    slot.u_end_time = end;
    slot.insert();
}

 

@Tanushree Maiti @Ankur Bawiskar 

0 REPLIES 0