Documentation Archive Developer
Search
Table of Contents Previous Section

Setting a Date Format

To change the way that dates are displayed, you assign a date format to the element that displays the dates.

  1. Inspect the dateReleased text field, which is near the bottom of the Main component window.

    Notice that the text field has a dateformat attribute that is bound to the string "%m/%d/%y". This binding tells the text field that it's displaying dates and describes how to format them. The %m conversion specifier stands for month as a decimal number, %d stands for day of the month, and %y stands for year without century.

  2. Change the dateformat value to the string (including the quotes) "%d %b %Y".

    This date format displays dates such as 3 Sep 1997. The %b conversion specifier stands for abbreviated month name, and %Y stands for year with century. You can create your own date formats with any of the conversion specifiers defined for dates. For more information, see the CalendarDate class specification in the Foundation Framework Reference.

Table of Contents Next Section