GlideDateTime - getUTCMidnight(Number dayOfTheWeek)

Gets a GlideDateTime object with the time set to midnight using the UTC time zone.

This method sets the date of the new GlideDateTime object as the specified day of the week within the week of the original GlideDateTime object.

Table 1. Parameters
Name Type Description
dayOfTheWeek Number The day of the week, from 1 to 7. Monday=1, Sunday=7. Do not enter 0 in this parameter.
Table 2. Returns
Type Description
GlideDateTime A new GlideDateTime object, set to midnight.

var gdt = new GlideDateTime("2011-08-31 08:00:00"); // Wednesday, 3rd day of the week.
gs.print(gdt.getUTCMidnight(5)); //Friday, 5th day of the week.

Output: 2011-09-02 00:00:00