GlideDateTime

GlideDateTime is, unsurprisingly, about scripting with dates and times, specifically the GlideDateTime object. The GlideDateTime object is mainly used to populate Date/Time fields and the methods around them to manipulate dates and times to add or remove time to a field.

First, let's look at defining a new GlideDateTime:

var glideDT = new GlideDateTime();

This will put the current date and time in GMT format in the glideDT field as part of a GlideDateTime object. This can be helpful if you want to compare a date in a field with the current date and time.

Now, with any date and time scripting, time zones are always an issue. One of the best ways to get around this is to use the display value to make sure dates and times are displayed ...

Get Mastering ServiceNow Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.