Configure the date and time format

Date and time calculation

On the frontend, Sitefinity CMS supports the following ways for calculating date and time:

  • Calculate the date and time server-side
    This is the default behavior. 
    All the dates are rendered according to the current culture of the page and the time zone of the current site in Sitefinity CMS. 

    By default, the date and time formats used by the date and time fields are h:mm a and M/dd/yyyy for time and date, respectively.

  • Calculate the date and time client-side
    The date and time can also be calculated on the client, using the client browsers time zone information.

Modify date and time calculation and format

You change the date and time settings by modifying the config.json file, located in the ~\SitefinityWebApp\AdminApp\ folder:

You do this by modifying the dateTimeFormat object, which has the following properties:

You can configure the following:

useBrowserLocale

By default, this property is set to false, which means that the date and time are calculated server-side.

If you set it to true, then date and time is calculated client-side.

browserLocaleFormatWidth 

This property can be short, medium or long.
If this property is not provided and useBrowserLocale is true, it defaults to short.

timeFormat

This property accepts the following values:

dateFormat

This property accepts the following values:

EXAMPLE: Example behavior of useBrowserLocale, if the browser's language is English (US).
  • If the browserLocaleFormatWidth is set to long, the formats used in the date and time field will be "h:mm:ss a" and "MMMM d, y", which looks like 9:22:13 am and July 10, 2021.
  • If the browserLocaleFormatWidth is set to medium, the formats used in the date and time field will be "h:mm:ss a" and "MMM d, y", which looks like 9:22:13 am and Jul 10, 2021.
  • If the browserLocaleFormatWidth is set to shor,t the formats used in the date and time field will be "h:mm a" and "M/d/yy", which will look like 9:22 AM and 7/10/2021.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?