pjs.getDatePattern()

pjs.getDatePattern()

Description

The pjs.getDatePattern() API converts a date format, such as *iso, *mdy, *ymd, or *usa, to a pattern, such as YYYY-MM-DD, MM/DD/YY, YY/MM/DD, or MM/DD/YYYY.

Parameters

  1. Date format - The date format to convert.

  2. Separator - The separator character to use in the pattern, for example / or -.

  3. Century (optional) - Used to prepend to the pattern for the *cymd, *cmdy, and *cdmy formats.

Return Value

The pattern, as a string.

Example

console.log(pjs.getDatePattern("*mdy", "/")); // outputs MM/DD/YY

Related Pages