javascriptodatasapui5sap-guisap-gateway

Find system date-time format from SAP GUI and use it in frontend


I have a SAPUI5 free-style app, where I display the date in a smart-table, in format DD/MM/YYYY.

However, in the frontend system in SAP GUI, my date format is MM-DD-YYYY. Is there a way to find this GUI date format and send it to the frontend app, so that I can modify the date format in my coding and display it accordingly?

I try to search it online. There are ways to find system time-zone, but no way to find date-format.

Thank you in advance.


Solution

  • The SAP table USR01 contains the GUI dateformat in the field DATFM. It's only a Char1, but its domain lists you all the specific values.

    You could then use a 'function import' in you OData service to get this value from the backend to your UI5 app.

    But you might want to reconsider, since formatting the date should be handled by the browser locale instead a backend. But if your requirement forces you to do that, the way described above would be possible.