var startTime = new GlideDateTime("2022-08-28 09:00:00");
var endTime = new GlideDateTime("2022-08-31 02:10:00");
// Duration in hours
var dur_seconds = gs.dateDiff(start, end, true); // returns the number of seconds as String
var dur_hours = Math.round(dur_seconds / 3600); // Math.round() is optional and will round the number to the nearest integer
gs.print(dur_hours);
Output:

How to calculate difference between two dates in hours ServiceNow ?
Working Code Asked question August 22, 2023
Sorry, you do not have permission to read comments.