Creating a Date/Time format

The Date and Time settings for your YaleSite come with many display options but might not display in the order or format that you want. You can add a new date format that will be available in the list of the standard date formats (Configuration > Date and Time formats >  .

YaleSites comes with a variety of Date formats, but they are limiting. However, you can easily create a new date format in the following way:
 

  1. Select Configuration from the Toolbar then Regional and Language > Date and Time formats. The Date and Time page displays.
    Data format configuration
  2. Click on the Formats tab and click on +Add format. The Formats dialog displays with the ability to configure and create custom formats. 

  3. Enter the PHP codes you using the PHP Manual link to indicate how you would like your date to be formatted. 
    Date and time php configuration

  4. The PHP manual provides explicit instructions for which codes to use to get the desired result. For this example, I wanted the date to be set to month/day/year so I used the following codes: l, F n, Y where l is the full day spelled out, F is the full month, n is the day number without the leading zero, and Y is the 4 digit year. The new format displays when the configuration is saved.
     Date and time formats

 Adding as a Type

Once you have created your format, you have the option to name the format as a Date Type so that it shows up as an option on the date formats list in your Views or format options for Content Types.

  1. Click on Add Date Type.
  2. Create a name (Date type) and choose your newly created date format (Date Format).
    Assign data and time format
  3. The new format displays in the list:
    Date and time format on list

Assigning the date format to the View or Content Type

Once the date has been created it will be available in the list for views and/or content types. Just click on the drop-down menu (in this case a view) and select it as an option. You can also use it for any of the standard formats including Long, Medium and Short.

View

Choosing a date and time format for a View

Choosing a date and time format for a view

Content Type

Choosing a date and time format for a Content Type:

Choosing a date and time format for a content type