Loading

Change the display format of a Date field on a Visualforce page

Data pubblicazione: Jun 18, 2026
Descrizione

How Date Format Is Determined in Visualforce

The format of date and datetime fields in Visualforce is controlled by the locale setting of the user's profile. For example, a US-based user sees dates in MM/DD/YYYY format, while a European user sees DD/MM/YYYY.
Sometimes it is appropriate to change this behavior or to display dates in a specific format regardless of the user's locale setting — for example, when your page must display dates consistently for all users regardless of their geographic location.

How to Change the Date Display Format

The date display format on a Visualforce page can be changed by using the language attribute on the <apex:page> tag. This attribute accepts an IETF language tag (a two-letter language code followed by a hyphen and a two-letter country code) and overrides the user's profile locale for date formatting on that specific page.

When to Use the Language Attribute

Setting the language attribute is most useful when your Visualforce page serves users from different regions and you need to enforce a consistent date format. For example, a European-facing page might enforce DD/MM/YYYY format for all users regardless of their individual locale settings.

Risoluzione

Setting the Language Attribute on apex:page

To change the date display format, set the language attribute in your opening <apex:page> tag using the appropriate IETF language tag.

For Italian locale (DD/MM/YYYY format):

<apex:page language="it-IT">

For Spanish locale (DD/MM/YYYY format):

<apex:page language="es-ES">

The same pattern applies to all other supported Salesforce locales.

Common Language Codes

Use these IETF language tags with the language attribute:

  • language='fr-FR' — French (France), uses DD/MM/YYYY
  • language='de-DE' — German (Germany), uses DD.MM.YYYY
  • language='ja-JP' — Japanese (Japan), uses YYYY/MM/DD
  • language='en-GB' — English (United Kingdom), uses DD/MM/YYYY
  • language='en-US' — English (United States), uses MM/DD/YYYY




Numero articolo Knowledge

000384965

 
Caricamento
Salesforce Help | Article