GlideDuration

A list of all the field attributes that could be found here on the docs.

Jace Benson

Table of content
  1. add
  2. getByFormat
  3. getDayPart
  4. getDisplayValue
  5. getDurationValue
  6. getRoundedDayPart
  7. getValue
  8. setDisplayValue
  9. setValue
  10. subtract
Property/Method Description

add

Adds a given duration to the current duration |

getByFormat

Gets the current duration in the given format DO NOT USE THIS AS IT DOESN'T WORK PROPERLY | This function sets the GlideDateTime object with a number of epoc milliseconds onthe total duration millisends and returns that. This causes odd results;

var days = 3;
var hours = days * 24;
var minutes = hours * 60;
var seconds = minutes * 60;
var mSeconds = seconds * 1000; //259,200,000 milliseconds === 3 days
var durDelta = new GlideDuration(mSeconds); //Exactly 3 days worth of milliseconds
gs.print(durDelta.getByFormat('dd hh:mm'));//Prints "04 12:00" Expected Output would be "03 00:00"

getDayPart

Gets the number of days |

getDisplayValue

Gets the display value of the duration in number of days, hours, and minutes |

getDurationValue

Gets the duration value in d HH:mm:ss format |

getRoundedDayPart

Gets the rounded number of days. If the time part is more than 12 hours, the return value is rounded up. Otherwise, it is rounded down |

getValue

Gets internal value of the this duration object. GlidDuration is stored as DateTime |

setDisplayValue

Sets the display value |

setValue

Sets the internal value of the GlideDuration object. Internally, GlidDuration is stored as DateTime |

subtract