Intro

This article describes the international rules for date formats. The SAPUI5 date formatters will help you to comply with these rules.

Usage

Use date formatting if:

  • You need to display dates based on the user’s locale settings.
  • The application is used in an international context.

Types

You can use five different types of date formats: short, mediumlongfull, and relative. The formatting and order of the values differ based on the locale settings that have been configured in the browser.

Short Format

Dates in the short format are displayed as digits for the day, month, and year. Use the correct formatting to avoid errors.

English (US): 8/7/17

Spanish (ES): 7/8/17

Chinese (CN): 17/8/7

German (DE): 07.08.17

Medium Format

In general, you should opt to use the medium date format, which usually shows an abbreviation of the month as text.

English (US): Aug 7, 2017

Spanish (ES): 7 de ago. de 2017

Chinese (CN): 2017年8月7日

German (DE): 07.08.2017

Long Format

Use the long format if you need to display the full names of months. For some languages there may be no difference between the medium and long formats.

English (US): August 7, 2017

Spanish (ES): 7 de agosto de 2017

Chinese (CN): 2017年8月7日

German (DE): 7. August 2017

Full Format

If you need to display the day of the week, use the full date format.

English (US): Friday, August 7, 2017

Spanish (ES): viernes, 7 de agosto de 2017

Chinese (CN): 2017年8月7日星期五

German (DE): Freitag, 7. August 2017

Relative 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.

English (US): 2 days ago, yesterday, today, tomorrow, in 2 days

Spanish (ES): hace dos días, ayer, hoy, mañana, dentro de 2 días

Chinese (CN): 2 天前,昨天,今天,明天,2 天后

German (DE): vor 2 Tagen, gestern, heute, morgen, in 2 Tagen

Guidelines

  • In general, use the medium date format.
  • Use the date picker control if dates have to be entered in an input field.

Object List Item and Object Header

Object list item and object header attributes should be formatted with the long type. If space is at a premium, for example, if attributes consist of a label and a date, use the short date format.

Resources

Want to dive deeper? Follow the links below to find out more about related controls, the SAPUI5 implementation, and the visual design.

Elements and Controls

Implementation