LinkedIn
Copied!

Table of Contents

Java date pattern

A Java date pattern is a sequence of one or more letters that controls the presentation of a date, or date and time. For example, the pattern MM/dd/yyyy is a request for a date to be presented in the format 07/04/1976 for July 4, 1976.

The standard function rule FormatDateTime() in the PegaRULES DateTime library can convert a DateTime property value according to a Java date pattern.

These letters are most often used in a date pattern. Case is significant.

  • y — Year as a number
  • M — Month, for example July, 07, or 7
  • w — week in year, as a number
  • D — Day in year, as a number
  • d — day in month
  • H — hour in day (0-23)

Time zones and locales can also be parameters to the FormatDateTime() function, so that the pattern "yyyy.MM.dd G 'at' HH:mm:ss" with time zone 08 (Pacific) and locale EN can produce the value 2006.07.04 at 12:08:56 PDT.

For a comprehensive description of pattern syntax, consult a Java language reference for the SimpleDateFormat class.

Did you find this content helpful?

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.