Administering : Managing business rules and expressions : Business rule definition examples : DateFormat example
  
DateFormat example
In this example, the DateFormat business rule is used to recognize a date pattern specified by the user, and to display the project’s planned release date according to the pattern.
To display the project’s planned release date in a pattern specified by the user
1 Add a module to track the project milestone dates by clicking Configure > Modules > Add Module.
2 Name the module as ProjectDates.
3 Add a date attribute named ReleaseDate to track the release date planned for the project.
4 Add a text attribute named Planned Release Date as a container attribute.
5 Enter the following expression as the Default Value for the Planned Release Date attribute:
=DateFormat('ReleaseDate',"MMMM dd, yyyy")
The date pattern can be anything that is valid for the Java SimpleDateFormat parser.
6 To validate the expression and to verify if the project release date is displayed in the pattern that you specified, click Evaluate Expression.
7 Make corrections, if required, and use the Planned Release Date whenever the planned release date is to be displayed in the format that you specified. For example, you can use the date in that pattern in the status report.
 
SimpleDateFormat pattern
Result
"yyyy.MMMMM.dd GGG hh:mm aaa"
2013.April.26 AD 03:41 PM
"yyyy.MM.dd G 'at' HH:mm:ss z"
2013.02.26 AD at 03:41:36 PDT
"EEE, d MMM yyyy HH:mm:ss Z"
Fri, 26 Apr 2013 03:41:36 -0700
"EEE, MMM d, ''yy"
Fri, Apr 26, '13
"h:mm a"
03:41 PM
"w"
17
"w" indicates the week of the year.
See also
DateFormat business rule
Business rule definition examples