Question: how to calculate date difference in servicenow?
Answer: var gdt1 = new GlideDateTime("2011-08-28 09:00:00"); var gdt2 = new GlideDateTime("2011-08-31 08:00:00"); var dur = new GlideDuration(); var dur = GlideDateTime. subtract(gdt1, gdt2); //the difference between gdt1 and gdt2. gs. print(dur. getDisplayValue());