pjs.fromLilianDate()

pjs.fromLilianDate()

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 CEEDATE.

For new code, it’s recommended to use standard JS Date methods and/or 3rd party Node.js libraries.

This API converts a number which represents the number of days since 14 October 1582 to a date string.

An exception will be thrown for any error.

Parameters

  1. Days (number). An integer representing the number of days since 14 October 1582. Must be in the range 1 to 3074324.

  2. Date format (string). A string representing the format of the date string to output. Valid formats are:
    DD/MM/YY
    DDMMYY
    MM/DD/YY
    MMDDYY
    YY/MM/DD
    YYMMDD
    MM/DD/YYYY
    MMDDYYYY
    DD.MM.YYYY
    DDMMYYYY
    YYYY-MM-DD
    YYYYMMDD

  3. Date (field name) a character field name defined with pjs.define() that will receive the date string.

Example

pjs.define("out", { type: 'char', length: 50, varying: true }); pjs.fromLilianDate(148138, 'YYYYMMDD', out); console.log(out); // 19880516