pjs.getUTCOffset()

pjs.getUTCOffset()

This API was added in version 7.17.0

This API is intended primarily for RPG to JavaScript code transformation scenarios, and provides a drop-in alternative to CEEUTCO.

For new code, it’s recommended to use standard JS Date method getTimezoneOffset()

This API returns the current offset from UTC to local time. For local time zones which are behind UTC time, the offset will be negative. For local time zones ahead of UTC time, the offset will be positive.

Parameters

  1. Hours (field name). A numeric field name defined with pjs.define() that will receive the number of hours between UTC and local time.

  2. Minutes (field name). A numeric field name defined with pjs.define() that will receive any remaining minutes.

  3. Seconds (field name). A numeric field name defined with pjs.define() that will receive the total offset between UTC and local time in seconds.

Example

pjs.define("hours", { type: 'integer', length: 10, decimals: 0 }); pjs.define("minutes", { type: 'integer', length: 10, decimals: 0 }); pjs.define("seconds", { type: 'float', length: 8 }); pjs.getUTCOffset(hours, minutes, seconds); // Output will vary based on timezone and time of year. // Example shown for USA Eastern Time on 6 February 2025 console.log(hours, minutes, seconds); // -5 0 -18000