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:
- Select Configuration from the Toolbar then Regional and Language > Date and Time formats. The Date and Time page displays.
-
Click on the Formats tab and click on +Add format. The Formats dialog displays with the ability to configure and create custom formats.
-
Enter the PHP codes you using the PHP Manual link to indicate how you would like your date to be formatted.
-
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.
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.
- Click on Add Date Type.
- Create a name (Date type) and choose your newly created date format (Date Format).
- The new format displays in the 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
Content Type
Choosing a date and time format for a Content Type: