GlideDateTime
The GlideDateTime class is for working with date/time fields and date/times in general.
Constructing a new GlideDateTime object using the new
keyword with no arguments initializes it to the current date and time in GMT. You can also initialize while passing in an argument: either another GlideDateTime object or a date-formatting string (in the UTC timezone) in the format: yyyy-MM-dd HH:mm:ss.
Note
An easy way to convert the value in a date/time field to a GlideDateTime object, is by using the getGlideObject()
method of the GlideElement class. Example:
var gdtStart = current.start_time.getGlideObject()
Adding or removing time
There are multiple methods for adding or removing time from a GlideDateTime object once it's initialized. Here are a few of the more useful ones.
The add()
method accepts one of two types of arguments: either a GlideTime object (an object containing a specific duration or amount of time), or a number of milliseconds.
You can add a specific number of days (local...