Page tree
Skip to end of metadata
Go to start of metadata

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


  1. Date format
  2. Separator (for example "/" or "-")
  3. Century (optional) - used to prepend to the pattern for "*cymd", "*cmdy", and "*cdmy" formats

Return value

String pattern


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