Scoped GlideDateTime - setDisplayValue(String value, String format)

Sets a date and time value using the current user's time zone and the specified date and time format. This method throws a runtime exception if the date and time format used in the value 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
value String The date and time in the current user's time zone.
format String The date and time format to use to parse the value parameter.
Table 2. Returns
Type Description
var gdt = new GlideDateTime("2011-02-02 12:00:00");
gdt.setDisplayValue("20-5-2011 12:00:00", "dd-MM-yyyy HH:mm:ss"); //uses current user session time zone (US/Pacific);