GlideDateTime - getYear()

Gets the year stored by the GlideDateTime object, expressed in the Java Virtual Machine time zone.

Use getYearLocalTime() and getYearUTC() instead of this method.

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
Number The 4-digit year value in the Java Virtual Machine time zone.

var gdt = new GlideDateTime(); //2011
gs.print(gdt.getYear());

Output: 2011