When fetching dates from a back end, the dates are sometimes returned in a format that is different from the one that you would like to use to display in your application UI. For example, your date might be in the format of MM/dd/yy HH:mm:ss aa zzz, while you would prefer it to be displayed in the format of MM/dd/yy. The Date Time Formatter can help you to change your Dates or Date Time values into the format of your choice.
Note that this type of date formatting can also be implemented using the Rich Data Definition builder, which can support similar formatting of date/time values and translation between the UI representation and the back end representation.
Here are some of the techniques illustrated in this IBM® WebSphere® Portlet Factory sample:
- The sample demonstrates how to format Dates, Date Time and Time values.
- It demonstrates the correct way to configure the Date Time Formatter builder.
- Note that when using the Date Time Formatter builder it is not enough to specify the format you want your dates to be in. You must also specify the format that your dates start out in. The starting format should be specified in the requested parsers section of the builder.
Notes on running the sample and prerequisites
Import the attached zip file into your project using the Import WebSphere Portlet Factory Archive command.