This article describes the international rules for date formats. The SAPUI5 date formatters will help you to comply with these rules.
Use date formatting if:
- You need to display dates based on the user’s locale settings.
- The application is used in an international context.
You can use five different types of date formats: short, medium, long, full, and relative. The formatting and order of the values differ based on the locale settings that have been configured in the browser.
Dates in short format are displayed as digits for the day, month and year. Use the right formatting to avoid errors caused by the wrong format!
Use the long format if you need to display the full names of months. Sometimes there is no difference between the medium and long format.
If you need to display the day of the week, use the full date format.
If it suits your use case, such as ongoing events within a period of six days, use the relative format. Relative dates are displayed as text, for example, today, 6 days, and so on.
The default range for relative dates is between -6 and 6 days relative to the current date.
- In general, use the medium date format.
- Use the DatePicker control when dates have to be entered in an input field.
Want to dive deeper? Follow the links below to find out more about related controls, the SAPUI5 implementation, and the visual design.