date.extractYear()

date.extractYear()

Description

The extractYear() method returns the year portion of a date or timestamp value.

Parameters

  1. Length (optional) - Number of digits to keep in the integer portion of the result. If the value has more digits, the leftmost digits are dropped.

  2. Decimals (optional) - Number of decimal positions to keep in the result.

Return Value

The numeric year value of the date or timestamp.

Example

pjs.define("date", { type: 'date', initValue: '2017-01-01' }); pjs.define("num", { type: 'zoned', length: 7, decimals: 2 }); num = date.extractYear(); return num; // 2017

RPG Equivalent

EXTRCT


Related Pages