GlideDateTime - setGlideDateTime(GlideDateTime gDT)

Sets the date and time of the current object using an existing GlideDateTime object.

This method is equivalent to instantiating a new object with a GlideDateTime parameter.

Table 1. Parameters
Name Type Description
gDT GlideDateTime A GlideDateTime object
Table 2. Returns
Type Description
void

Scoped equivalent

To use the setGlideDateTime() method in a scoped application, use the corresponding scoped method: Scoped GlideDateTime - setGlideDateTime(GlideDateTime g).

var dt1 = new GlideDateTime("2011-01-01 12:00:00");
var dt2 = new GlideDateTime("2011-02-02 08:00:00");
dt1.setGlideDateTime(dt2);
gs.print(dt1.getValue());

Output:

2011-02-02 08:00:00