GlideDate and GlideDateTime examples

The GlideDate and GlideDateTime APIs are used to manipulate date and time values.

Note: This functionality requires a knowledge of JavaScript.

For additional information, refer to GlideDate and GlideDateTime on the ServiceNow Developers site.

You can create a GlideDateTime object from a GlideDate object by passing in the GlideDate object as a parameter to the GlideDateTime constructor.
var gDate = new GlideDate();
gDate.setValue('2015-01-01');
gs.info(gDate);
 
var gDT = new GlideDateTime(gDate);
gs.info(gDT);
Output:
2015-01-01
2015-01-01 00:00:00