Skip to Content
Technical Articles
Author's profile photo Alexander Schmalzhaf

UI5 SmartControls: How to use “Date” and “Time”-related Data Types



It is quite important to sort out the right combination of OData (V2) Data Type / Annotations and SmartControl settings to match the targeted use case perfectly.

In date- and time-related issues it is not always obvious which combination fits the concrete use case best. Below you find a list to understand a bit when to use what.

Usage recommendation

(sorted descending to their importance/frequency of use):


For Dates

Example “Dec. 12th, 2020”
OData Service Metadata
Edm.DateTime with sap:display-format="Date"
UI The SmartControls show only the “date” part of the timestamp, independent of the local time zone (e.g. there is no shift of a date when looked at from two different machines in two different timezones). For input, a date picker is offered.
Real-world sample Use this data type for all dates that are globally not shifted, e.g. birthdays (Mr. Gauß was born on Apr. 30th, 1777, independent if you speak about it in India or America).


For Time Stamps containing Date and Time

Example “Dec. 12th, 2020, 19:22:39”
OData Service Metadata
UI The SmartControls show data and time in local user time zone. For input, a DateTime picker is offered.
Real-world sample Use this data type for timestamps that should be shown in the users timezone, e.g. build timestamps, creation timestamps (a car production was completed at Dec. 12th, 10:21:32 GMT) or the beginning of a virtual meeting (here, every user wants to see “her” specific start timestamp).


For Time Stamps containing Date and Time, displayed in their local representation

Example “Jun. 3rd, 2019, 10:00:00”
OData Service Metadata

Currently not well supported by the SAPUI5 SmartControls.

A work around could be to use a combination of two fields, one typed as Edm.DateTime with sap:display-format=”Date” and one typed as Edm.Time.

Real-world sample Use this data type to present a timestamp in its “local” representation and not recalculated to the user’s timezone, e.g. for arrival of a plain on a certain airport (where the user wants to see the local date/time, not recalculated to her current time zone).


For Times

Example “19:33:49”
OData Service Metadata
UI The SmartControls show the time as given by the service. For input, a time picker is offered.
Real-world sample Use this data type to express a certain time on a fixed date or on no specific date, e.g. start and end times for sessions on a onsite event.



With the above mentioned hints it might got clearer which data type needs to be taken in the OData service. But there is even more! For further details and hints about how the functions and features of the UI5 Smart Controls can be leveraged and wich specific OData features are supported, please see also the “Smart Controls” area in the UI5 documentation and the respective API reference pages of the controls (SmartField, SmartFilterBar, SmartTable, SmartChart).


Assigned tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Aashima Arya
      Aashima Arya

      Dear Alexandar,


      Thank you for sharing this.

      Is there any way i can set time with zone?

      lets suppose time format is long and if i want to edit the time - it should allow me to select time and zone both.


      Thank you,


      Author's profile photo Alexander Schmalzhaf
      Alexander Schmalzhaf
      Blog Post Author

      Hello Ashima,


      although this question is about a year old let me shortly answer:

      The only possibility to maintain both, (date)time AND timezone, is by modeling these two fields explicitly in the data model.

      So when you really need the possibility to maintain a timezone, you should introduce a property for it. Only with that, you also could think of providing a valuelist for the property listing all availbale timezones.

      Best regards


      Author's profile photo Aashima Arya
      Aashima Arya

      Thank you 🙂

      Author's profile photo Frank Müller
      Frank Müller

      Dear Alexandar,

      Thank you very much for sharing this.

      Do you know if it is planned, that the smart controls will support Edm.DateTime for timestamps correctly?

      Best regards



      Author's profile photo Alexander Schmalzhaf
      Alexander Schmalzhaf
      Blog Post Author

      Hello Frank,

      according to my knowledge there are currently no discussions to change the support for Edm.DateTime.

      However, there have been discussions to enhance the Edm.DateTimeOffset handling:

      DateTimeOffset is used for date and time - where these are currently recalculated to the local timezone. The point of discussion has been to enable a second "mode": Display a DateTimeOffset timestamp in the timezone given.

      That might also fulfill your requirement.

      Unfortunately I cannot say how the discussions went on and if and when it will make it to the product...



      Author's profile photo Frank Müller
      Frank Müller

      Hi Alex,

      thank you very much for your reply.

      That is interesting.

      I'm wondering how I can show / filter timestamps in UTC in a Firoi Elements App without splitting it into 2 fields.

      Is there any Annotation available / planned for it?

      Best regards