GlideDateTime - setValueUTC(String dateTime, String format)

Sets a date and time value using the UTC time zone and the specified date and time format.

This method throws a runtime exception if the date and time format used in the dateTime parameter does not match the format parameter. You can retrieve the error message by calling getErrorMsg() on the GlideDateTime object after the exception is caught.

Table 1. Parameters
Name Type Description
dateTime String The date and time to use.
format String The format to use.
Table 2. Returns
Type Description

Scoped equivalent

To use the setValueUTC() method in a scoped application, use the corresponding scoped method: Scoped GlideDateTime - setValueUTC(String dt, String format).

var gdt = new GlideDateTime("2011-01-01 12:00:00");
gdt.setValueUTC("15-02-2011 08:00:00", "dd-MM-yyyy HH:mm:ss");


2011-02-15 08:00:00