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.
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 time or UTC) using addDaysLocalTime()
or addDaysUTC().
Neither method returns a value.
The same is true for adding time week-by-week (addWeeksLocalTime()
and addWeeksUTC()
), month-by-month (addMonthsLocalTime()
and...