Sitefinity Classic Editor DateTime format

sitefinity | 2021-03-20

🚩 What are the Issues?

  • Content Edit Page – Displays date in mm/dd/yyyy format.

screen1

  • Content Listing Page – Shows unknown time format (AM/PM).

screen2


💡 What I Did to Resolve It?

To resolve the date and time format issues in Sitefinity Classic Editor, follow these steps:

1. Add a New ViewMap Control

- Navigate to **Advanced Settings** → **Controls** → **ViewMap** → **Create New**.
- Set the following properties:
  - **HostType**: `Telerik.Sitefinity.Web.UI.Fields.DateField, Telerik.Sitefinity`
  - **Layout**: `~/Utils/Extensions/DateFieldExtended.ascx`

Sample Implementation: GitHub Gist - hawjeh/sample sitefinity classic editor datetime

2. Update Content Type Listing DateTime Format

- Go to **Advanced Setting** → **DynamicModules** → **Controls** → **<Custom Module Backend Definition>**.
- Under **Views** → **<Module Backend List>** → **View Modes** → **Grid** → **Columns** → **<Field>** → **Client Template**.
- Modify the client template to use the preferred date and time format:

<span>{{ (Start) ? Start.sitefinityLocaleFormat(‘dd/MM/yyyy hh:mm tt’): ‘-‘ }}</span>

3. Apply Changes to LastModified, DateCreated Fields

Repeat the above steps for other datetime fields like LastModified and DateCreated to ensure consistency in the content listing.

🔥 Resolved Screen

  • Content Edit Screen

screen3

  • Content Listing Screen

screen4

📚 References