Scoped GlideDateTime - subtract(GlideDateTime start, GlideDateTime end)

Gets the duration difference between two GlideDateTime values.

Table 1. Parameters
Name Type Description
Start GlideDateTime The start value.
End GlideDateTime The end value.
Table 2. Returns
Type Description
GlideDuration The duration between the two values.
var gdt1 = new GlideDateTime("2011-08-28 09:00:00");
var gdt2 = new GlideDateTime("2011-08-31 08:00:00");
 
var dur = GlideDateTime.subtract(gdt1, gdt2); //the difference between gdt1 and gdt2
gs.info(dur.getDisplayValue());

Output: 2 Days 23 Hours